diff --git a/src/seat.c b/src/seat.c index 816e58dd..c16cdcda 100644 --- a/src/seat.c +++ b/src/seat.c @@ -31,6 +31,19 @@ input_device_destroy(struct wl_listener *listener, void *data) wl_list_remove(&keyboard->key.link); wl_list_remove(&keyboard->modifier.link); keyboard_cancel_keybind_repeat(keyboard); + /* + * If the active keyboard on the seat is destroyed, fall back + * to the keyboard from keyboard group so we can respond to + * wl_seat.get_keyboard requests with wl_keyboard.keymap event. + * This prevents Chromium from crashing when started just after + * the active keyboard is destroyed. + */ + struct wlr_keyboard *active_keyboard = + wlr_seat_get_keyboard(input->seat->seat); + if (!active_keyboard || active_keyboard == keyboard->wlr_keyboard) { + wlr_seat_set_keyboard(input->seat->seat, + &input->seat->keyboard_group->keyboard); + } } free(input); }