Re: [AD] win32 allegro_exit() blocks on non-active Window

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


> i am using the 4.0.3  version...

Patch for the 4.0.x branch attached.

> is this unactive window / install_keyb() problem  'known'  for 4.0.3 ?

No, AFAIK it's the first time it is reported.

-- 
Eric Botcazou
--- /home/eric/cvs/allegro-4_0-branch/include/allegro/platform/aintwin.h	Sun Jan 12 19:06:04 2003
+++ allegro-4_0-branch/include/allegro/platform/aintwin.h	Wed May 28 10:22:53 2003
@@ -109,8 +109,9 @@
 AL_FUNC(void, sys_directx_remove_display_switch_callback, (AL_METHOD(void, cb, (void))));
 
 AL_FUNC(void, sys_switch_in, (void));
-
 AL_FUNC(void, sys_switch_out, (void));
+AL_FUNC(void, sys_reset_switch_mode, (void));
+
 AL_FUNC(int, thread_switch_out, (void));
 AL_FUNC(void, midi_switch_out, (void));
 
diff -u /home/eric/cvs/allegro-4_0-branch/src/win/wdispsw.c allegro-4_0-branch/src/win/wdispsw.c
--- /home/eric/cvs/allegro-4_0-branch/src/win/wdispsw.c	Mon Dec 23 00:51:17 2002
+++ allegro-4_0-branch/src/win/wdispsw.c	Wed May 28 10:20:10 2003
@@ -37,12 +37,24 @@
 
 
 
+/* sys_reset_switch_mode:
+ *  Resets the switch mode to its initial state.
+ */
+void sys_reset_switch_mode(void)
+{
+   app_foreground = TRUE;
+   SetEvent(foreground_event);  /* release blocked threads */
+   set_display_switch_mode(SWITCH_BACKGROUND);
+}
+
+
+
 /* sys_directx_display_switch_init:
  */
 void sys_directx_display_switch_init(void)
 {
    _foreground_event = CreateEvent(NULL, TRUE, TRUE, NULL);
-   set_display_switch_mode(SWITCH_PAUSE);
+   sys_reset_switch_mode();
 }
 
 
diff -u /home/eric/cvs/allegro-4_0-branch/src/win/wsystem.c allegro-4_0-branch/src/win/wsystem.c
--- /home/eric/cvs/allegro-4_0-branch/src/win/wsystem.c	Mon Dec 23 00:51:17 2002
+++ allegro-4_0-branch/src/win/wsystem.c	Wed May 28 10:27:22 2003
@@ -342,6 +342,9 @@
    wnd_unacquire_keyboard();
    wnd_unacquire_mouse();
 
+   /* restore initial switch mode */
+   sys_reset_switch_mode();
+
    /* re-size and hide window */
    SetWindowPos(allegro_wnd, HWND_TOP, wnd_rect.left, wnd_rect.top,
 		wnd_rect.right - wnd_rect.left, wnd_rect.bottom - wnd_rect.top,
diff -u /home/eric/cvs/allegro-4_0-branch/src/win/wwnd.c allegro-4_0-branch/src/win/wwnd.c
--- /home/eric/cvs/allegro-4_0-branch/src/win/wwnd.c	Mon May 19 13:18:49 2003
+++ allegro-4_0-branch/src/win/wwnd.c	Wed May 28 10:21:05 2003
@@ -317,12 +317,7 @@
       case WM_DESTROY:
          if (user_wnd_proc) {
             exit_window_modules(NULL);
-
-            /* The system may have sent a WA_INACTIVE message, so we need
-             * to wake up the timer thread, supposing we are in SWITCH_PAUSE
-             * or SWITCH_AMNESIA mode.
-             */
-            SetEvent(_foreground_event);
+            sys_reset_switch_mode();
          }
          else {
             PostQuitMessage(0);


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