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.
This commit is contained in:
Sam Lantinga
2012-10-02 10:38:10 -07:00
parent 5918660a41
commit 12c6a1cec8

View File

@@ -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