From ef520725ed4d9ae2880f2681d301dd583ec4fae6 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 | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/shell.c b/src/shell.c index 9a9127b..96299d0 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1866,7 +1866,21 @@ 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. + * + * Mark both the old and new views as having dirty geometry. */ + weston_view_geometry_dirty(shsurf->view); + wl_list_remove(&shsurf->view->layer_link); + wl_list_insert(&ws->layer.view_list, + &shsurf->view->layer_link); + weston_view_geometry_dirty(shsurf->view); } static void @@ -1882,12 +1896,25 @@ 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. + * + * Mark both the old and new views as having dirty geometry. */ + weston_view_geometry_dirty(shsurf->view); + wl_list_remove(&shsurf->view->layer_link); + wl_list_insert(&shell->fullscreen_layer.view_list, + &shsurf->view->layer_link); + weston_view_geometry_dirty(shsurf->view); } static void -- 1.8.3.1