From 4d78a995442fca5b5fe26dc161341fe4ced67cea Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 26 Mar 2018 12:38:29 -0700 Subject: [PATCH] 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 ); } --- src/video/windows/SDL_windowsevents.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index a5fd00689ddfb..5b15b92ef7c04 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -421,6 +421,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) POINT cursorPos; BOOL minimized; + /* Don't mark the window as shown if it's activated before being shown */ + if (!IsWindowVisible(hwnd)) { + break; + } + minimized = HIWORD(wParam); if (!minimized && (LOWORD(wParam) != WA_INACTIVE)) { if (LOWORD(wParam) == WA_CLICKACTIVE) {