stack-tracker: Keep override redirect windows on top

Since commit 6b5cf2e, we keep override redirect windows on a layer
above regular windows in the clutter actor scene graph. In the X
server, and thus for input purposes, these windows might end up being
stacked below regular windows though, e.g. because a new regular
window is mapped after an OR window.

Fix this disconnect by re-stacking OR windows on top when syncing the
window stack with the compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=780485
This commit is contained in:
Rui Matos 2017-05-19 17:11:19 +02:00
parent 777963eeb6
commit e3d5bc077d

View File

@ -168,6 +168,9 @@ struct _MetaStackTracker
guint sync_stack_later;
};
static void
meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker);
static inline const char *
get_window_desc (MetaStackTracker *tracker,
guint64 window)
@ -835,6 +838,8 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
tracker->sync_stack_later = 0;
}
meta_stack_tracker_keep_override_redirect_on_top (tracker);
meta_stack_tracker_get_stack (tracker, &windows, &n_windows);
meta_windows = NULL;
@ -1040,6 +1045,37 @@ meta_stack_tracker_lower (MetaStackTracker *tracker,
meta_stack_tracker_raise_above (tracker, window, None);
}
static void
meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker)
{
MetaWindow *window;
guint64 *stack;
int n_windows, i;
int topmost_non_or;
meta_stack_tracker_get_stack (tracker, &stack, &n_windows);
for (i = n_windows - 1; i >= 0; i--)
{
window = meta_display_lookup_stack_id (tracker->screen->display, stack[i]);
if (window && window->layer != META_LAYER_OVERRIDE_REDIRECT)
break;
}
topmost_non_or = i;
for (i -= 1; i >= 0; i--)
{
window = meta_display_lookup_stack_id (tracker->screen->display, stack[i]);
if (window && window->layer == META_LAYER_OVERRIDE_REDIRECT)
{
meta_stack_tracker_raise_above (tracker, stack[i], stack[topmost_non_or]);
meta_stack_tracker_get_stack (tracker, &stack, &n_windows);
topmost_non_or -= 1;
}
}
}
void
meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
const guint64 *managed,