diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-06-07 15:07:07 +0300 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-06-07 16:44:13 -0400 |
commit | bdc7cd06d1829a46ae4e7bb31955ae251b616241 (patch) | |
tree | 01e302f8d78250ebd77b676c0d6716a91d28d061 | |
parent | 43e1ba8073c32e0b5017c8059f0d0e0d9df887c8 (diff) |
compositor: fix a crash on missing keyboard device
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
-rw-r--r-- | src/compositor.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/compositor.c b/src/compositor.c index 3039c3d..94de667 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1656,16 +1656,19 @@ weston_surface_activate(struct weston_surface *surface, { struct weston_compositor *compositor = seat->compositor; - wl_keyboard_set_focus(seat->seat.keyboard, &surface->surface); - wl_data_device_set_keyboard_focus(&seat->seat); - - if (seat->seat.keyboard->focus_resource) { - wl_keyboard_send_modifiers(seat->seat.keyboard->focus_resource, - wl_display_next_serial(compositor->wl_display), - seat->xkb_state.mods_depressed, - seat->xkb_state.mods_latched, - seat->xkb_state.mods_locked, - seat->xkb_state.group); + if (seat->seat.keyboard) { + wl_keyboard_set_focus(seat->seat.keyboard, &surface->surface); + wl_data_device_set_keyboard_focus(&seat->seat); + + if (seat->seat.keyboard->focus_resource) { + wl_keyboard_send_modifiers( + seat->seat.keyboard->focus_resource, + wl_display_next_serial(compositor->wl_display), + seat->xkb_state.mods_depressed, + seat->xkb_state.mods_latched, + seat->xkb_state.mods_locked, + seat->xkb_state.group); + } } wl_signal_emit(&compositor->activate_signal, surface); |