mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
wayland: cancel key repeat when keyboard focus is lost
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).
This commit is contained in:
parent
2793c9cfb0
commit
d133a5f6f7
@ -731,6 +731,12 @@ static void
|
||||
keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
|
||||
uint32_t serial, struct wl_surface *surface)
|
||||
{
|
||||
struct SDL_WaylandInput *input = data;
|
||||
|
||||
/* Stop key repeat before clearing keyboard focus */
|
||||
keyboard_repeat_clear(&input->keyboard_repeat);
|
||||
|
||||
/* This will release any keys still pressed */
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user