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 - ALT+TAB on Windows 7 with Aero theme doesn't release ALT key modifier state
Summary: ALT+TAB on Windows 7 with Aero theme doesn't release ALT key modifier state
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: All Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-24 22:12 UTC by buckyballreaction
Modified: 2013-05-22 17:33 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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