diff options
author | 2024-05-27 15:43:56 +0530 | |
---|---|---|
committer | 2024-07-02 15:13:29 -0400 | |
commit | dfbcd1fbaa5148e537a1c29dc3cbe8ea21ee5eac (patch) | |
tree | ebd5b586de63f92c2018f68290e06bc5c2200b79 | |
parent | config/output: Skip VRR tests when not supported (diff) | |
download | sway-dfbcd1fbaa5148e537a1c29dc3cbe8ea21ee5eac.tar.gz sway-dfbcd1fbaa5148e537a1c29dc3cbe8ea21ee5eac.tar.zst sway-dfbcd1fbaa5148e537a1c29dc3cbe8ea21ee5eac.zip |
input/keyboard: don't send key release if we don't have focused surface
"The compositor must not send this event if the wl_keyboard did not
have an active surface immediately before this event. The compositor
must not send this event if state is pressed (resp. released) and the
key was already logically down (resp. was not logically down)
immediately before this event."
From https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/382
-rw-r--r-- | sway/input/keyboard.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 9ac21664..e33dbe0b 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -509,12 +509,13 @@ static void handle_key_event(struct sway_keyboard *keyboard, | |||
509 | } | 509 | } |
510 | 510 | ||
511 | if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { | 511 | if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { |
512 | // If the pressed event was sent to a client, also send the released | 512 | // If the pressed event was sent to a client and we have a focused |
513 | // surface immediately before this event, also send the released | ||
513 | // event. In particular, don't send the released event to the IM grab. | 514 | // event. In particular, don't send the released event to the IM grab. |
514 | bool pressed_sent = update_shortcut_state( | 515 | bool pressed_sent = update_shortcut_state( |
515 | &keyboard->state_pressed_sent, event->keycode, | 516 | &keyboard->state_pressed_sent, event->keycode, |
516 | event->state, keyinfo.keycode, 0); | 517 | event->state, keyinfo.keycode, 0); |
517 | if (pressed_sent) { | 518 | if (pressed_sent && seat->wlr_seat->keyboard_state.focused_surface) { |
518 | wlr_seat_set_keyboard(wlr_seat, keyboard->wlr); | 519 | wlr_seat_set_keyboard(wlr_seat, keyboard->wlr); |
519 | wlr_seat_keyboard_notify_key(wlr_seat, event->time_msec, | 520 | wlr_seat_keyboard_notify_key(wlr_seat, event->time_msec, |
520 | event->keycode, event->state); | 521 | event->keycode, event->state); |