From fe9491443c6fe6d9a16538a28b2aeee2afe3c664 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Fri, 10 Nov 2023 22:53:17 -0500 Subject: [PATCH] keyboard: remove exceptions from storing pressed keys These exceptions were added to prevent certain keys (modifiers and synthetic layout switch key-events) from disabling keybindings (due to the "nr_pressed_keys > 1" check). That check no longer exists, so the exceptions should no longer be necessary. Partially reverts e77330bc3fe7 and 3e2baa3f05ac. --- src/input/keyboard.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/input/keyboard.c b/src/input/keyboard.c index 005fa263..e3526b7f 100644 --- a/src/input/keyboard.c +++ b/src/input/keyboard.c @@ -230,25 +230,14 @@ handle_compositor_keybindings(struct keyboard *keyboard, */ bool is_modifier = false; - bool is_layout_switch = false; uint32_t modifiers = wlr_keyboard_get_modifiers(wlr_keyboard); for (int i = 0; i < translated.nr_syms; i++) { is_modifier |= is_modifier_key(translated.syms[i]); - is_layout_switch |= translated.syms[i] == XKB_KEY_ISO_Next_Group; } - /* - * An earlier press event from a key that causes a layout change event - * might have been added already without us knowing that it actually was - * a XKB_KEY_ISO_Next_Group sym. Thus we always try to remove the current - * key from the set of pressed keys on release. - */ - if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { - key_state_set_pressed(event->keycode, false); - } else if (!is_modifier && !is_layout_switch) { - key_state_set_pressed(event->keycode, true); - } + key_state_set_pressed(event->keycode, + event->state == WL_KEYBOARD_KEY_STATE_PRESSED); if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { /*