Blame SOURCES/0001-stack-tracker-Keep-override-redirect-windows-on-top.patch

67f8b7
From 245a3c2e12b4aad2e752675f82be9517235d5498 Mon Sep 17 00:00:00 2001
67f8b7
From: Rui Matos <tiagomatos@gmail.com>
67f8b7
Date: Fri, 19 May 2017 17:11:19 +0200
67f8b7
Subject: [PATCH] stack-tracker: Keep override redirect windows on top
67f8b7
67f8b7
Since commit 6b5cf2e, we keep override redirect windows on a layer
67f8b7
above regular windows in the clutter actor scene graph. In the X
67f8b7
server, and thus for input purposes, these windows might end up being
67f8b7
stacked below regular windows though, e.g. because a new regular
67f8b7
window is mapped after an OR window.
67f8b7
67f8b7
Fix this disconnect by re-stacking OR windows on top when syncing the
67f8b7
window stack with the compositor.
67f8b7
67f8b7
https://bugzilla.gnome.org/show_bug.cgi?id=780485
67f8b7
---
67f8b7
 src/core/stack-tracker.c | 36 ++++++++++++++++++++++++++++++++++++
67f8b7
 1 file changed, 36 insertions(+)
67f8b7
67f8b7
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
67f8b7
index a76b42cbf..82afd644a 100644
67f8b7
--- a/src/core/stack-tracker.c
67f8b7
+++ b/src/core/stack-tracker.c
67f8b7
@@ -168,6 +168,9 @@ struct _MetaStackTracker
67f8b7
   guint sync_stack_later;
67f8b7
 };
67f8b7
 
67f8b7
+static void
67f8b7
+meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker);
67f8b7
+
67f8b7
 static inline const char *
67f8b7
 get_window_desc (MetaStackTracker *tracker,
67f8b7
                  guint64           window)
67f8b7
@@ -835,6 +838,8 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
67f8b7
       tracker->sync_stack_later = 0;
67f8b7
     }
67f8b7
 
67f8b7
+  meta_stack_tracker_keep_override_redirect_on_top (tracker);
67f8b7
+
67f8b7
   meta_stack_tracker_get_stack (tracker, &windows, &n_windows);
67f8b7
 
67f8b7
   meta_windows = NULL;
67f8b7
@@ -1040,6 +1045,37 @@ meta_stack_tracker_lower (MetaStackTracker *tracker,
67f8b7
   meta_stack_tracker_raise_above (tracker, window, None);
67f8b7
 }
67f8b7
 
67f8b7
+static void
67f8b7
+meta_stack_tracker_keep_override_redirect_on_top (MetaStackTracker *tracker)
67f8b7
+{
67f8b7
+  MetaWindow *window;
67f8b7
+  guint64 *stack;
67f8b7
+  int n_windows, i;
67f8b7
+  int topmost_non_or;
67f8b7
+
67f8b7
+  meta_stack_tracker_get_stack (tracker, &stack, &n_windows);
67f8b7
+
67f8b7
+  for (i = n_windows - 1; i >= 0; i--)
67f8b7
+    {
67f8b7
+      window = meta_display_lookup_stack_id (tracker->screen->display, stack[i]);
67f8b7
+      if (window && window->layer != META_LAYER_OVERRIDE_REDIRECT)
67f8b7
+        break;
67f8b7
+    }
67f8b7
+
67f8b7
+  topmost_non_or = i;
67f8b7
+
67f8b7
+  for (i -= 1; i >= 0; i--)
67f8b7
+    {
67f8b7
+      window = meta_display_lookup_stack_id (tracker->screen->display, stack[i]);
67f8b7
+      if (window && window->layer == META_LAYER_OVERRIDE_REDIRECT)
67f8b7
+        {
67f8b7
+          meta_stack_tracker_raise_above (tracker, stack[i], stack[topmost_non_or]);
67f8b7
+          meta_stack_tracker_get_stack (tracker, &stack, &n_windows);
67f8b7
+          topmost_non_or -= 1;
67f8b7
+        }
67f8b7
+    }
67f8b7
+}
67f8b7
+
67f8b7
 void
67f8b7
 meta_stack_tracker_restack_managed (MetaStackTracker *tracker,
67f8b7
                                     const guint64    *managed,
67f8b7
-- 
67f8b7
2.13.0
67f8b7