Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug where SDL thought the window was shown and it wasn't actually.
Browse files Browse the repository at this point in the history
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 e22d558
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/windows/SDL_windowswindow.c
Expand Up @@ -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
Expand Down

0 comments on commit e22d558

Please sign in to comment.