[gnome-shell] Workspace/WorkspaceThumbnail: fix Clutter warnings from stacking code



commit ceae0321122ea31b6eca017cbf9440c3833a1260
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jan 19 02:22:15 2013 +0100

    Workspace/WorkspaceThumbnail: fix Clutter warnings from stacking code
    
    Windows can be restacked at any time, including when the stackAbove
    property of the window clone is being dragged, and thus parented to
    the uiGroup. To do stacking properly, we need to skip it for the duration
    of the drag, and sync it again at the end (which is already done by
    mutter because of the workspace change)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685285

 js/ui/workspace.js          |   22 ++++++++++++++++++++--
 js/ui/workspaceThumbnail.js |   27 +++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 3e954f4..e2e461d 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -121,15 +121,33 @@ const WindowClone = new Lang.Class({
             return this._slot;
     },
 
+    // Find the actor just below us, respecting reparenting done
+    // by DND code
+    getActualStackAbove: function() {
+        if (this._stackAbove == null)
+            return null;
+
+        if (this.inDrag || this._zooming) {
+            if (this._stackAbove._delegate)
+                return this._stackAbove._delegate.getActualStackAbove();
+            else
+                return null;
+        } else {
+            return this._stackAbove;
+        }
+    },
+
     setStackAbove: function (actor) {
         this._stackAbove = actor;
         if (this.inDrag)
             // We'll fix up the stack after the drag
             return;
-        if (this._stackAbove == null)
+
+        let actualAbove = this.getActualStackAbove();
+        if (actualAbove == null)
             this.actor.lower_bottom();
         else
-            this.actor.raise(this._stackAbove);
+            this.actor.raise(actualAbove);
     },
 
     destroy: function () {
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 540f3d3..4537b92 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -62,12 +62,35 @@ const WindowClone = new Lang.Class({
         this.inDrag = false;
     },
 
+    // Find the actor just below us, respecting reparenting done
+    // by DND code
+    getActualStackAbove: function() {
+        if (this._stackAbove == null)
+            return null;
+
+        if (this.inDrag) {
+            if (this._stackAbove._delegate)
+                return this._stackAbove._delegate.getActualStackAbove();
+            else
+                return null;
+        } else {
+            return this._stackAbove;
+        }
+    },
+
     setStackAbove: function (actor) {
         this._stackAbove = actor;
-        if (this._stackAbove == null)
+
+        // Don't apply the new stacking now, it will be applied
+        // when dragging ends and window are stacked again
+        if (actor.inDrag)
+            return;
+
+        let actualAbove = this.getActualStackAbove();
+        if (actualAbove == null)
             this.actor.lower_bottom();
         else
-            this.actor.raise(this._stackAbove);
+            this.actor.raise(actualAbove);
     },
 
     destroy: function () {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]