Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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.
  • Loading branch information
slouken committed Oct 2, 2012
1 parent b9e5e98 commit e22d5580f65832a5857b579055d7f09249f8e8be
Showing with 2 additions and 2 deletions.
  1. +2 −2 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

0 comments on commit e22d558

Please sign in to comment.