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 5501 - [PATCH] Key repeats forever after focus loss on Wayland
Summary: [PATCH] Key repeats forever after focus loss on Wayland
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-24 23:24 UTC by Cameron Gutman
Modified: 2021-01-26 02:58 UTC (History)
0 users

See Also:


Attachments
Patch (1.24 KB, patch)
2021-01-24 23:25 UTC, Cameron Gutman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Gutman 2021-01-24 23:24:49 UTC
SDL_SetKeyboardFocus(NULL) will lift any keys still pressed when keyboard focus
leaves the window, but then key repeat comes behind our backs and presses the
key down again. This results in an infinite stream of SDL_KEYDOWN events when
focus leaves the window with a key down (particularly noticeable with Alt+Tab).

The fix is simply to call keyboard_repeat_clear() in keyboard_handle_leave().
Comment 1 Cameron Gutman 2021-01-24 23:25:17 UTC
Created attachment 4702 [details]
Patch
Comment 2 Sam Lantinga 2021-01-26 02:58:00 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/e9b56cbc004d