summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-12-07 11:54:11 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2018-02-12 13:14:39 +0200
commit1a0239e40ffc945b55a4f3218ae9a41ce0f143e3 (patch)
tree1c0ca8616ba8dfcc87cc7363d1d84197647c14ee /desktop-shell
parentff5e88d2765a1888f1f06a5198e5204a379ce5e3 (diff)
desktop-shell: handle redundant panels
If for some reason the helper client weston-desktop-shell would create more than one panel surface for the same weston_output, this code would corrupt the surface destroy listener list by adding a link already in one list into another list. Instead, do not store the new, redundant panel surface and do not subscribe to its destruction. Also, tell the helper that the surface is redundant by configuring it with a 0x0 size, so that we don't waste memory on a panel that is never used. (Clone mode is a valid reason why weston-desktop-shell could do that.) Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 18d88553..1c35d18a 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3068,16 +3068,25 @@ desktop_shell_set_panel(struct wl_client *client,
weston_surface_set_label_func(surface, panel_get_label);
surface->output = weston_output_from_resource(output_resource);
view->output = surface->output;
- weston_desktop_shell_send_configure(resource, 0,
- surface_resource,
- surface->output->width,
- surface->output->height);
sh_output = find_shell_output_from_weston_output(shell, surface->output);
- sh_output->panel_surface = surface;
+ if (sh_output->panel_surface) {
+ /* The output already has a panel, tell our helper
+ * there is no need for another one. */
+ weston_desktop_shell_send_configure(resource, 0,
+ surface_resource,
+ 0, 0);
+ } else {
+ weston_desktop_shell_send_configure(resource, 0,
+ surface_resource,
+ surface->output->width,
+ surface->output->height);
- sh_output->panel_surface_listener.notify = handle_panel_surface_destroy;
- wl_signal_add(&surface->destroy_signal, &sh_output->panel_surface_listener);
+ sh_output->panel_surface = surface;
+
+ sh_output->panel_surface_listener.notify = handle_panel_surface_destroy;
+ wl_signal_add(&surface->destroy_signal, &sh_output->panel_surface_listener);
+ }
}
static int