From d1eccbd8aa316982fc40113d735ce2239ea83910 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 29 Dec 2011 04:29:53 -0500 Subject: [PATCH] Fixed bugs 1034 and 1035 zicodxx@gmx.de 2010-07-28 12:59:27 PDT Again another bug I encountered on Windows 7: Assuming I hide my mouse cusor with SDL_ShowCursor(SDL_DISABLE). Now if my app runs on Fullscreen, I tend to "get out" of it using ALT+TAB. This will minimize the app. However SDL_GetAppState will STILL report SDL_APPACTIVE, SDL_APPINPUTFOCUS and SDL_APPMOUSEFOCUS. Also if I check event.active.gain, this *seems* (as much as I could find out) to be set twice (first 0 then 1 again) while going out of the app with ALT+TAB. I am not perfectly sure here but even if the app is minimized because of ALT+TAB (or also CTRL+ESC), event.active.gain is 1. Alex Volkov 2011-04-28 17:19:26 PDT This happens with the windib driver. Windows posts the WM_ACTIVATE WA_INACTIVE event with minimized==false when you Alt+Tab out of a fullscreen app. Responding to this event, wincommon/SDL_sysevents.c:WinMessage() calls ShowWindow(,SW_MINIMIZE) via SDL_RestoreDesktopMode, but another WM_ACTIVATE event is not posted in response to that. Whatever the case may be, WinMessage() should just treat a fullscreen app receiving WA_INACTIVE the same as a minimized app. Additionally, it's probably a good idea to clear SDL_APPMOUSEFOCUS at the same time, and that should take care of bug #1035. --- src/video/wincommon/SDL_sysevents.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index 39af302b1..cd45f189e 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -309,6 +309,8 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if ( WINDIB_FULLSCREEN() ) { appstate |= SDL_APPMOUSEFOCUS; SDL_RestoreDesktopMode(); + /* A fullscreen app gets hidden but will not get a minimize event */ + appstate |= (SDL_APPACTIVE | SDL_APPMOUSEFOCUS); #if defined(_WIN32_WCE) LoadAygshell(); if( SHFullScreen )