Fixed bug where SDL thought the window was shown and it wasn't actually.
authorSam Lantinga <slouken@libsdl.org>
Tue, 02 Oct 2012 10:38:10 -0700
changeset 6535 b117349cc8aa
parent 6534 8faa51147576
child 6536 d761a7490c4a
Fixed bug where SDL thought the window was shown and it wasn't actually. From Rick Johnson: Here's the call pattern: Create the window hidden The game tells it to adjust the window position Make the window visible. A problem arises from the SetWindowsPos() - the default behavior of that would cause a WM_ACTIVATE message to be passed, of which SDL interprets that as the window now becoming visible and sets the flags. The window is not visible though. Now, when you try to call ShowWindow() - SDL sees those flags as indicating that the window is visible and early returns. My proposed fix was that if we are calling set windows position and we aren't visible, add on the flag SWP_NOACTIVATE, which tells windows to not send down the WM_ACTIVATE flag.
src/video/windows/SDL_windowswindow.c
--- a/src/video/windows/SDL_windowswindow.c	Tue Oct 02 13:29:59 2012 -0300
+++ b/src/video/windows/SDL_windowswindow.c	Tue Oct 02 10:38:10 2012 -0700
@@ -377,13 +377,13 @@
 void
 WIN_SetWindowPosition(_THIS, SDL_Window * window)
 {
-    WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE);
+    WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
 }
 
 void
 WIN_SetWindowSize(_THIS, SDL_Window * window)
 {
-    WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE);
+    WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE);
 }
 
 void