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 e77330bc3f and 3e2baa3f05.
This commit is contained in:
John Lindgren 2023-11-10 22:53:17 -05:00 committed by Johan Malm
parent 5a77a3ad51
commit fe9491443c

View file

@ -230,25 +230,14 @@ handle_compositor_keybindings(struct keyboard *keyboard,
*/ */
bool is_modifier = false; bool is_modifier = false;
bool is_layout_switch = false;
uint32_t modifiers = wlr_keyboard_get_modifiers(wlr_keyboard); uint32_t modifiers = wlr_keyboard_get_modifiers(wlr_keyboard);
for (int i = 0; i < translated.nr_syms; i++) { for (int i = 0; i < translated.nr_syms; i++) {
is_modifier |= is_modifier_key(translated.syms[i]); is_modifier |= is_modifier_key(translated.syms[i]);
is_layout_switch |= translated.syms[i] == XKB_KEY_ISO_Next_Group;
} }
/* key_state_set_pressed(event->keycode,
* An earlier press event from a key that causes a layout change event event->state == WL_KEYBOARD_KEY_STATE_PRESSED);
* 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);
}
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
/* /*