diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c index a76b42cbf..82afd644a 100644 --- a/src/core/stack-tracker.c +++ b/src/core/stack-tracker.c @@ -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,