diff options
author | Nicolas Guyomard <nicolas.guyomard@open.eurogiciel.org> | 2014-12-04 15:43:22 +0100 |
---|---|---|
committer | Nicolas Guyomard <nicolas.guyomard@open.eurogiciel.org> | 2014-12-08 14:04:57 +0100 |
commit | 18def246cb8ba3755b82d8243e3f4a50585c543a (patch) | |
tree | 94dc06a1acb5a791484c025a32af2a3eb9ea35c9 | |
parent | a50ea85f6f5d481a697b4c1e28e2fe51fe52cc24 (diff) | |
download | weston-18def246cb8ba3755b82d8243e3f4a50585c543a.tar.gz weston-18def246cb8ba3755b82d8243e3f4a50585c543a.tar.bz2 weston-18def246cb8ba3755b82d8243e3f4a50585c543a.zip |
Fix show_input_panel_surface crash when no surface has focus
Change-Id: Ia5105e9c7173a75ec166db170624fa7c9963820a
-rw-r--r-- | desktop-shell/input-panel.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c index 435cd5d6..f5bb8b32 100644 --- a/desktop-shell/input-panel.c +++ b/desktop-shell/input-panel.c @@ -69,10 +69,12 @@ show_input_panel_surface(struct input_panel_surface *ipsurf) if (!seat->keyboard) continue; focus = weston_surface_get_main_surface(seat->keyboard->focus); - ipsurf->output = focus->output; - x = ipsurf->output->x + (ipsurf->output->width - ipsurf->surface->width) / 2; - y = ipsurf->output->y + ipsurf->output->height - ipsurf->surface->height; - weston_view_set_position(ipsurf->view, x, y); + if (focus) { + ipsurf->output = focus->output; + x = ipsurf->output->x + (ipsurf->output->width - ipsurf->surface->width) / 2; + y = ipsurf->output->y + ipsurf->output->height - ipsurf->surface->height; + weston_view_set_position(ipsurf->view, x, y); + } } weston_layer_entry_insert(&shell->input_panel_layer.view_list, |