Fix Wayland keyrepeat getting cancelled by unrelated keyup (#11052)

fixes #11048

## Problem
in the situation `press right`, `press left`, `release right` the
following happens right now:

- `keypressed right`, `current_keysym` is set to `right`
- `keypressed left`, `current_keysym` is set to `left`

the repeat timer runs asynchronously and emits keyrepeats since
`current_keysym.is_some()`

- `keyreleased right`, `current_keysym` is set to None

the repeat timer no longer emits keyrepeats

- `keyreleased left`, this is where `current_keysym` should actually be
set to None.

## Solution
Only reset `current_keysym` if the released key matches the last pressed
key.

Release Notes:

- N/A
This commit is contained in:
Jakob Hellermann 2024-04-26 23:07:05 +02:00 committed by GitHub
parent 7bd18fa653
commit 393b16d226
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -843,7 +843,9 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
keystroke: Keystroke::from_xkb(keymap_state, state.modifiers, keycode), keystroke: Keystroke::from_xkb(keymap_state, state.modifiers, keycode),
}); });
state.repeat.current_keysym = None; if state.repeat.current_keysym == Some(keysym) {
state.repeat.current_keysym = None;
}
drop(state); drop(state);
focused_window.handle_input(input); focused_window.handle_input(input);