diff options
author | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-12-07 12:39:15 +0200 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2018-02-12 13:14:39 +0200 |
commit | 1cbfcf49a76ae1f2b67c0f8fb906923fb40a1b22 (patch) | |
tree | c1d3a5539230753a22591075001e20f797d10b4e /clients/desktop-shell.c | |
parent | cb1153804948d184ddcd4d0b42710639e3369971 (diff) | |
download | weston-1cbfcf49a76ae1f2b67c0f8fb906923fb40a1b22.tar.gz |
clients/desktop-shell: avoid invalid sized panel
If for some reason the desktop-shell plugin would configure a panel with
an invalid size, just destroy the whole panel and forget about it for
this wl_output.
A following patch will cause desktop-shell to configure 0x0 panel when
it deems the panel redundant.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'clients/desktop-shell.c')
-rw-r--r-- | clients/desktop-shell.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 87234116..d75c8631 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -96,6 +96,9 @@ struct output; struct panel { struct surface base; + + struct output *owner; + struct window *window; struct widget *widget; struct wl_list launcher_list; @@ -526,6 +529,9 @@ panel_resize_handler(struct widget *widget, } static void +panel_destroy(struct panel *panel); + +static void panel_configure(void *data, struct weston_desktop_shell *desktop_shell, uint32_t edges, struct window *window, @@ -534,6 +540,15 @@ panel_configure(void *data, struct desktop *desktop = data; struct surface *surface = window_get_user_data(window); struct panel *panel = container_of(surface, struct panel, base); + struct output *owner; + + if (width < 1 || height < 1) { + /* Shell plugin configures 0x0 for redundant panel. */ + owner = panel->owner; + panel_destroy(panel); + owner->panel = NULL; + return; + } switch (desktop->panel_position) { case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP: @@ -593,13 +608,14 @@ panel_destroy(struct panel *panel) } static struct panel * -panel_create(struct desktop *desktop) +panel_create(struct desktop *desktop, struct output *output) { struct panel *panel; struct weston_config_section *s; panel = xzalloc(sizeof *panel); + panel->owner = output; panel->base.configure = panel_configure; panel->window = window_create_custom(desktop->display); panel->widget = window_add_widget(panel->window, panel); @@ -1277,7 +1293,7 @@ output_init(struct output *output, struct desktop *desktop) struct wl_surface *surface; if (desktop->want_panel) { - output->panel = panel_create(desktop); + output->panel = panel_create(desktop, output); surface = window_get_wl_surface(output->panel->window); weston_desktop_shell_set_panel(desktop->shell, output->output, surface); |