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

Summary: [PATCH] Key repeats forever after focus loss on Wayland
Product: SDL Reporter: Cameron Gutman <cameron.gutman>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   
Attachments: Patch

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