[AD] [WIN] Fix startup behaviour

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


The attached patch fixes the behaviour of Allegro at startup, i.e the window 
is not automatically put on the foreground anymore. Nice *but*, according to 
the CVS log, I introduced this trick when fixing the infamous Win2k bug so 
the patch may cause problems on NT kernels. Specifically, the keyboard may be 
disabled until after the window is switched out then switched in.

Therefore I would you like some Win2k/WinXP users to test it before I commit 
it (simply check that tests/test.exe and tests/win/dxwindow.exe still work as 
usual). Alternatively, I could commit it now so that the next CVS snapshot 
includes it.

-- 
Eric Botcazou

--- /cvs/allegro/include/allegro/platform/aintwin.h	Wed Oct  9 14:14:14 2002
+++ allegro/include/allegro/platform/aintwin.h	Tue Oct 29 18:13:28 2002
@@ -76,6 +76,7 @@
 AL_VAR(int, wnd_width);
 AL_VAR(int, wnd_height);
 AL_VAR(int, wnd_sysmenu);
+AL_VAR(int, wnd_show_state);
 
 AL_FUNCPTR(void, user_close_proc, (void));
 
diff -ur /cvs/allegro/src/win/wsystem.c allegro/src/win/wsystem.c
--- /cvs/allegro/src/win/wsystem.c	Fri Oct  4 12:26:42 2002
+++ allegro/src/win/wsystem.c	Tue Oct 29 18:13:00 2002
@@ -516,6 +516,8 @@
 
    argv[argc] = NULL;
 
+   wnd_show_state = nShow;
+
    /* call the application entry point */
    i = mainfunc(argc, argv);
 
diff -ur /cvs/allegro/src/win/wwnd.c allegro/src/win/wwnd.c
--- /cvs/allegro/src/win/wwnd.c	Tue Oct 15 17:46:26 2002
+++ allegro/src/win/wwnd.c	Wed Oct 30 18:39:30 2002
@@ -39,6 +39,7 @@
 int wnd_width = 0;
 int wnd_height = 0;
 int wnd_sysmenu = FALSE;
+int wnd_show_state = SW_SHOWNORMAL;
 
 static int last_wnd_x = 32;
 static int last_wnd_y = 32;
@@ -403,8 +404,9 @@
       return NULL;
    }
 
-   ShowWindow(wnd, SW_SHOWNORMAL);
-   SetForegroundWindow(wnd);
+   ShowWindow(wnd, wnd_show_state);
+   wnd_show_state = SW_SHOWNORMAL;
+
    UpdateWindow(wnd);
 
    return wnd;
--- /cvs/allegro/todo.txt	Fri Oct 18 10:07:36 2002
+++ allegro/todo.txt	Sat Oct 26 09:49:10 2002
@@ -26,7 +25,6 @@

 ---------------------------------------------------------------------------

-- Fix ill-behaviour at startup (SetForeground)
 - Investigate plugins script support
 - Investigate problem with keyboard in the dxwindow test



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