Fixed bug where an SDL window that was activated while hidden could never be shown.
Test code:
{
SDL_Window *win = SDL_CreateWindow( "Dummy", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 128, 128, SDL_WINDOW_HIDDEN );
SDL_SysWMinfo info;
SDL_VERSION( &info.version );
SDL_GetWindowWMInfo( win, &info );
SetActiveWindow( info.info.win.window );
{
DWORD then = SDL_GetTicks();
while ( ( SDL_GetTicks() - then ) < 3000 )
{
SDL_Event evt;
SDL_PollEvent( &evt );
}
SDL_ShowWindow( win );
then = SDL_GetTicks();
while ( ( SDL_GetTicks() - then ) < 3000 )
{
SDL_Event evt;
SDL_PollEvent( &evt );
}
}
SDL_DestroyWindow( win );
}
1.1 --- a/src/video/windows/SDL_windowsevents.c Sat Mar 24 10:26:40 2018 -0700
1.2 +++ b/src/video/windows/SDL_windowsevents.c Mon Mar 26 12:38:29 2018 -0700
1.3 @@ -421,6 +421,11 @@
1.4 POINT cursorPos;
1.5 BOOL minimized;
1.6
1.7 + /* Don't mark the window as shown if it's activated before being shown */
1.8 + if (!IsWindowVisible(hwnd)) {
1.9 + break;
1.10 + }
1.11 +
1.12 minimized = HIWORD(wParam);
1.13 if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) {
1.14 if (LOWORD(wParam) == WA_CLICKACTIVE) {