From e22d5580f65832a5857b579055d7f09249f8e8be Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 2 Oct 2012 10:38:10 -0700 Subject: [PATCH] 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index f0c29b100..38902ac80 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -377,13 +377,13 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) 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