keyboard: update xkb state after key event

fixes #6946
This commit is contained in:
Vaxry 2024-07-25 13:10:53 +02:00
parent daf5fad190
commit cd942ad12d

View file

@ -32,13 +32,13 @@ CKeyboard::CKeyboard(SP<Aquamarine::IKeyboard> keeb) : keyboard(keeb) {
listeners.key = keeb->events.key.registerListener([this](std::any d) { listeners.key = keeb->events.key.registerListener([this](std::any d) {
auto E = std::any_cast<Aquamarine::IKeyboard::SKeyEvent>(d); auto E = std::any_cast<Aquamarine::IKeyboard::SKeyEvent>(d);
updateXkbStateWithKey(E.key + 8, E.pressed);
keyboardEvents.key.emit(SKeyEvent{ keyboardEvents.key.emit(SKeyEvent{
.timeMs = E.timeMs, .timeMs = E.timeMs,
.keycode = E.key, .keycode = E.key,
.state = E.pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED, .state = E.pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED,
}); });
updateXkbStateWithKey(E.key + 8, E.pressed);
}); });
listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) { listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) {