input/text_input: ensure keyboard is set before sending modifiers

Clients get confused when modifier events are sent before the
keymap.
This commit is contained in:
Simon Ser 2024-05-24 23:53:46 +02:00 committed by Simon Zeni
parent 700f4805bc
commit df69367d92
1 changed files with 3 additions and 1 deletions

View File

@ -66,11 +66,13 @@ static void handle_im_keyboard_grab_destroy(struct wl_listener *listener, void *
struct sway_input_method_relay *relay = wl_container_of(listener, relay,
input_method_keyboard_grab_destroy);
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data;
struct wlr_seat *wlr_seat = keyboard_grab->input_method->seat;
wl_list_remove(&relay->input_method_keyboard_grab_destroy.link);
if (keyboard_grab->keyboard) {
// send modifier state to original client
wlr_seat_keyboard_notify_modifiers(keyboard_grab->input_method->seat,
wlr_seat_set_keyboard(wlr_seat, keyboard_grab->keyboard);
wlr_seat_keyboard_notify_modifiers(wlr_seat,
&keyboard_grab->keyboard->modifiers);
}
}