mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-02 07:23:52 -04:00
tinywl: fix crash if there is no keyboard
To reproduce, run WLR_BACKENDS=headles tinywl -s foot
This commit is contained in:
parent
c8d97e2791
commit
6e492521d6
1 changed files with 7 additions and 3 deletions
|
|
@ -114,7 +114,6 @@ static void focus_view(struct tinywl_view *view, struct wlr_surface *surface) {
|
||||||
seat->keyboard_state.focused_surface);
|
seat->keyboard_state.focused_surface);
|
||||||
wlr_xdg_toplevel_set_activated(previous, false);
|
wlr_xdg_toplevel_set_activated(previous, false);
|
||||||
}
|
}
|
||||||
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
|
||||||
/* Move the view to the front */
|
/* Move the view to the front */
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
wl_list_insert(&server->views, &view->link);
|
wl_list_insert(&server->views, &view->link);
|
||||||
|
|
@ -125,8 +124,13 @@ static void focus_view(struct tinywl_view *view, struct wlr_surface *surface) {
|
||||||
* track of this and automatically send key events to the appropriate
|
* track of this and automatically send key events to the appropriate
|
||||||
* clients without additional work on your part.
|
* clients without additional work on your part.
|
||||||
*/
|
*/
|
||||||
wlr_seat_keyboard_notify_enter(seat, view->xdg_surface->surface,
|
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
|
||||||
keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers);
|
if (keyboard != NULL) {
|
||||||
|
wlr_seat_keyboard_notify_enter(seat, view->xdg_surface->surface,
|
||||||
|
keyboard->keycodes, keyboard->num_keycodes, &keyboard->modifiers);
|
||||||
|
} else {
|
||||||
|
wlr_seat_keyboard_notify_enter(seat, surface, NULL, 0, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keyboard_handle_modifiers(
|
static void keyboard_handle_modifiers(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue