We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1608

Summary: ALT+TAB on Windows 7 with Aero theme doesn't release ALT key modifier state
Product: SDL Reporter: buckyballreaction
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Windows 7   

Description buckyballreaction 2012-09-24 22:12:57 UTC
On Windows 7 with an Aero theme enabled, if you ALT+TAB out of an SDL2 application, the ALT modifier state (KMOD_LALT is what I used) stays on.  

Upon focus gain, (SDL_GetModState() & KMOD_ALT) will always return true.  

This is problematic if you wish to capture the ALT key in the application for some purpose (ALT + ENTER to resize), because it thinks the ALT key is already pressed and you may cause an undesired action.

The workaround is to do something like this in the even loop:

   case SDL_WINDOWEVENT_FOCUS_LOST:
      SDL_SetModState(KMOD_NONE);
      break;

This does not occur on Windows XP, or Windows 7 with Aero turned off.
Comment 1 buckyballreaction 2013-05-22 17:33:17 UTC
This bug appears to be gone as of hg rev 53df899db00b