stack-tracker: Don't sort O-R's under guard window on top

As of "stack-tracker: Keep override redirect windows on top"
(e3d5bc077d), we always sorted all
override redirect on top of regular windows, as so is expected by
regular override redirect windows. This had an unwanted consequence,
however, which is that we should still not sort such override redirect
windows on top if they are behind the guard window, as that'd result in
windows hidden behind it now getting restacked anyway.

Fix this by only sorting the override redirect windows that are found
above the guard window on top. This fixes the override-redirect stacking
test.
This commit is contained in:
Jonas Ådahl 2018-07-12 10:18:54 +02:00
parent 161d2540e6
commit 356cad094b

View File

@ -778,6 +778,18 @@ meta_stack_tracker_configure_event (MetaStackTracker *tracker,
stack_tracker_event_received (tracker, &op); stack_tracker_event_received (tracker, &op);
} }
static gboolean
meta_stack_tracker_is_guard_window (MetaStackTracker *tracker,
uint64_t stack_id)
{
MetaX11Display *x11_display = tracker->display->x11_display;
if (!x11_display)
return FALSE;
return stack_id == x11_display->guard_window;
}
/** /**
* meta_stack_tracker_get_stack: * meta_stack_tracker_get_stack:
* @tracker: a #MetaStackTracker * @tracker: a #MetaStackTracker
@ -1063,7 +1075,6 @@ meta_stack_tracker_lower (MetaStackTracker *tracker,
static void static void
meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker) meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker)
{ {
MetaWindow *window;
guint64 *stack; guint64 *stack;
int n_windows, i; int n_windows, i;
int topmost_non_or; int topmost_non_or;
@ -1072,6 +1083,8 @@ meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker)
for (i = n_windows - 1; i >= 0; i--) for (i = n_windows - 1; i >= 0; i--)
{ {
MetaWindow *window;
window = meta_display_lookup_stack_id (tracker->display, stack[i]); window = meta_display_lookup_stack_id (tracker->display, stack[i]);
if (window && window->layer != META_LAYER_OVERRIDE_REDIRECT) if (window && window->layer != META_LAYER_OVERRIDE_REDIRECT)
break; break;
@ -1081,6 +1094,11 @@ meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker)
for (i -= 1; i >= 0; i--) for (i -= 1; i >= 0; i--)
{ {
MetaWindow *window;
if (meta_stack_tracker_is_guard_window (tracker, stack[i]))
break;
window = meta_display_lookup_stack_id (tracker->display, stack[i]); window = meta_display_lookup_stack_id (tracker->display, stack[i]);
if (window && window->layer == META_LAYER_OVERRIDE_REDIRECT) if (window && window->layer == META_LAYER_OVERRIDE_REDIRECT)
{ {