]> git.mdlowis.com Git - proto/labwc.git/commitdiff
keyboard: remove exceptions from storing pressed keys
authorJohn Lindgren <john@jlindgren.net>
Sat, 11 Nov 2023 03:53:17 +0000 (22:53 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 12 Nov 2023 17:37:30 +0000 (17:37 +0000)
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

index 005fa263db1a4192beddc1519bed7934bc2e33eb..e3526b7f3b0dacf5932e079fcc389bec70d66f18 100644 (file)
@@ -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) {
                /*