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

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