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 1626

Summary: Keys don't get released when a window loses focus in X
Product: SDL Reporter: Sik <sik.the.hedgehog>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   

Description Sik 2012-10-22 11:39:53 UTC
When a window loses focus in X, it seems like the status of any keys that were pressed is not reset, which results in the program thinking they were never released (I've confirmed this in my program by making it show the status of some keys). Ideally, the program should think all keys are unreleased when the window loses focus.

This bug is really serious with Alt+Tab, since it means the Alt modifier keeps being held down, and any program that relies on modifiers for shortcuts will be unable to detect the shortcuts properly until the user presses the Alt key again (this keeps constantly biting me back as the level editor in my game relies on them, rendering it unusable).

Using Ubuntu 11.04 64-bit.
Comment 1 Ryan C. Gordon 2013-07-11 00:33:28 UTC
This got fixed at some point; getting a FocusOut event in X11 eventually results in an SDL_ResetKeyboard() call, which resets any pressed keys to released.

Confirmed working on a Ubuntu 12.04 install.

--ryan.