]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/keyboard.c: register keys before inhibit check
authorJohan Malm <jgm323@gmail.com>
Tue, 30 Aug 2022 20:07:27 +0000 (21:07 +0100)
committerJohan Malm <jgm323@gmail.com>
Wed, 21 Sep 2022 20:25:13 +0000 (21:25 +0100)
Call key_state_set_pressed() before checking
seat->active_client_while_inhibited to avoid missing release events for
clients using the inhibit protocol (for example swaylock).

src/keyboard.c

index ae68b8f5b6aa6fad06abc866e9487dad761167b4..4849a2f4f3d6099c1bfd10e756f58a6673bba831 100644 (file)
@@ -124,6 +124,15 @@ handle_compositor_keybindings(struct wl_listener *listener,
        key_state_set_pressed(keycode,
                event->state == WL_KEYBOARD_KEY_STATE_PRESSED);
 
+       /*
+        * Ignore labwc keybindings if input is inhibited
+        * It's important to do this after key_state_set_pressed() to ensure
+        * _all_ key press/releases are registered
+        */
+       if (seat->active_client_while_inhibited) {
+               return false;
+       }
+
        /*
         * If a user lets go of the modifier (e.g. alt) before the 'normal' key
         * (e.g. tab) when window-cycling, we do not end the cycling until both
@@ -233,12 +242,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
        struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
        wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
 
-       bool handled = false;
-
-       /* ignore labwc keybindings if input is inhibited */
-       if (!seat->active_client_while_inhibited) {
-               handled = handle_compositor_keybindings(listener, event);
-       }
+       bool handled = handle_compositor_keybindings(listener, event);
 
        if (!handled) {
                wlr_seat_set_keyboard(wlr_seat, keyboard);