From b9f00b6bc2f716b76791558bafb3c3e166e1d3e5 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 5 Nov 2013 14:50:53 +0000 Subject: [PATCH] shell: Ensure transient surfaces are included in the layer of their parent This fixes a bug whereby a surface which is transient for a fullscreen surface could end up being stacked below it. https://bugs.freedesktop.org/show_bug.cgi?id=69443 --- src/shell.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/shell.c b/src/shell.c index 9a9127b..fc78745 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1866,7 +1866,18 @@ set_surface_type(struct shell_surface *shsurf) static void set_toplevel(struct shell_surface *shsurf) { - shsurf->next_type = SHELL_SURFACE_TOPLEVEL; + struct desktop_shell *shell = shsurf->shell; + struct workspace *ws = get_current_workspace(shell); + + shsurf->next_type = SHELL_SURFACE_TOPLEVEL; + + /* Remove it from its current layer and insert it into the normal + * layer so that surfaces which were previously fullscreen or transient + * are no longer rendered on top. */ + wl_list_remove(&shsurf->view->layer_link); + wl_list_insert(&ws->layer.view_list, + &shsurf->view->layer_link); + weston_surface_damage(shsurf->surface); } static void @@ -1882,12 +1893,22 @@ static void set_transient(struct shell_surface *shsurf, struct weston_surface *parent, int x, int y, uint32_t flags) { + struct desktop_shell *shell = shsurf->shell; + /* assign to parents output */ shsurf->parent = parent; shsurf->transient.x = x; shsurf->transient.y = y; shsurf->transient.flags = flags; shsurf->next_type = SHELL_SURFACE_TRANSIENT; + + /* Remove it from its current layer and insert it into its parent layer + * so that surfaces which are transient for fullscreen surfaces don't + * get hidden by the fullscreen surfaces. */ + wl_list_remove(&shsurf->view->layer_link); + wl_list_insert(&shell->fullscreen_layer.view_list, + &shsurf->view->layer_link); + weston_surface_damage(shsurf->surface); } static void -- 1.8.3.1