Re: [AD] x color conversion again (w/ responsiveness patch)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
It applies cleanly to CVS, so I guess I had some random patches still installed. However, programs I try to run simply hang. Could you send me your latest patches again? I may be using an old version.

Here's the latest patches. This does differ slightly from the last one I posted as it follows the method Elias used (calling the input handler directly before actually releasing the last lock), although uses a new function (_xwin_handle_input_nolock) to do it.

The diffs should be applied from right outside Allegro's directory.

- Kitty Cat
--- allegro/include/allegro/platform/aintunix.h	2003-02-07 05:29:06.000000000 -0800
+++ allegro/include/allegro/platform/aintunix.h	2004-07-14 01:34:57.000000000 -0700
@@ -85,24 +85,45 @@
    AL_FUNC(void, _xwin_handle_input, (void));
 
 
+#ifndef ALLEGRO_MULTITHREADED
+
+   AL_FUNC(void, _xwin_handle_input_nolock, (void));
+   AL_VAR(int, _xwin_missed_input);
+
    #define XLOCK()                              \
       do {                                      \
-         if (_unix_bg_man->multi_threaded) {    \
-            if (_xwin.display)                  \
-               XLockDisplay(_xwin.display);     \
-         }                                      \
          _xwin.lock_count++;                    \
       } while (0)
 
    #define XUNLOCK()                            \
       do {                                      \
-         if (_unix_bg_man->multi_threaded) {    \
-            if (_xwin.display)                  \
-               XUnlockDisplay(_xwin.display);   \
+         if (_xwin.lock_count == 1) {           \
+            while(_xwin_missed_input) {         \
+               _xwin_handle_input_nolock();     \
+               --_xwin_missed_input;            \
+            }                                   \
          }                                      \
          _xwin.lock_count--;                    \
       } while (0)
 
+#else
+
+   #define XLOCK()                              \
+      do {                                      \
+         if (_xwin.display)                     \
+            XLockDisplay(_xwin.display);        \
+         _xwin.lock_count++;                    \
+      } while (0)
+
+   #define XUNLOCK()                            \
+      do {                                      \
+         if (_xwin.display)                     \
+            XUnlockDisplay(_xwin.display);      \
+         _xwin.lock_count--;                    \
+      } while (0)
+
+#endif
+
 #endif
 
 
--- allegro/src/x/xwin.c	2004-07-11 03:33:10.000000000 -0700
+++ allegro/src/x/xwin.c	2004-07-14 01:35:33.000000000 -0700
@@ -139,6 +139,10 @@
    NULL         /* window close hook */
 };
 
+#ifndef ALLEGRO_MULTITHREADED
+int _xwin_missed_input;
+#endif
+
 void *allegro_icon = alex_xpm;
 
 int _xwin_last_line = -1;
@@ -2092,13 +2096,13 @@
 
 void _xwin_vsync(void)
 {
-   XLOCK();
+   int prev = retrace_count;
+
+/*   XLOCK();
    _xwin_private_vsync();
-   XUNLOCK();
+   XUNLOCK();*/
 
    if (_timer_installed) {
-      int prev = retrace_count;
-
       do {
       } while (retrace_count == prev);
    }
@@ -2432,9 +2436,24 @@
    }
 }
 
+#ifndef ALLEGRO_MULTITHREADED
+void _xwin_handle_input_nolock(void)
+{
+   if (_xwin_input_handler)
+      _xwin_input_handler();
+   else
+      _xwin_private_handle_input();
+}
+#endif
+
 void _xwin_handle_input(void)
 {
-   if (_xwin.lock_count) return;
+#ifndef ALLEGRO_MULTITHREADED
+   if (_xwin.lock_count) {
+      ++_xwin_missed_input;
+      return;
+   }
+#endif
 
    XLOCK();
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/