From da704d97faef87520c5b055e4b5c8d1f6c8fc1be Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 25 Nov 2013 18:01:46 +0000 Subject: [PATCH] shell: Change stacking order calculation for popup surfaces Always put them as the top-most layer in the layer list of their parent. This ensures that, for example, the popup menu produced by right-clicking on a surface (which is not currently at the top of the stacking order in the current workspace) is displayed at the top of the stacking order. --- src/shell.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/shell.c b/src/shell.c index 804a57e6..dfcb5250 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2097,11 +2097,36 @@ shell_surface_calculate_layer_link (struct shell_surface *shsurf) struct workspace *ws; switch (shsurf->type) { - case SHELL_SURFACE_POPUP: + case SHELL_SURFACE_POPUP: { + /* Popups should go at the front of the workspace of their + * parent surface, rather than just in front of the parent. This + * fixes the situation where there are two top-level windows: + * - Above + * - Below + * and a pop-up menu is created for 'Below'. We want: + * - Popup + * - Above + * - Below + * not: + * - Above + * - Popup + * - Below + */ + struct shell_surface *parent_shsurf; + + parent_shsurf = get_shell_surface(shsurf->parent); + if (parent_shsurf != NULL) + return shell_surface_calculate_layer_link(parent_shsurf); + + break; + } + case SHELL_SURFACE_TRANSIENT: { /* Move the surface to its parent layer so that surfaces which * are transient for fullscreen surfaces don't get hidden by the - * fullscreen surfaces. */ + * fullscreen surfaces. However, unlike popups, transient + * surfaces are stacked in front of their parent but not in + * front of other surfaces of the same type. */ struct weston_view *parent; /* TODO: Handle a parent with multiple views */