[gnome-shell/wip/exalm/gestures2: 4/7] workspaceAnimation: Use window clones



commit 10a8c4caa68c8a550c7f5c68c4b3881ea93bc321
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Jul 4 23:15:15 2019 +0500

    workspaceAnimation: Use window clones
    
    Instead of reparenting windows, clone them. This will allow to properly
    support multi-monitor setups in subsequent commits.
    
    Block window mapping animation while the animation is running to prevent
    new windows appearing during the animation from being visible at the same
    time as their clones.
    
    Fixes https://gitlab.gnome.org/GNOME/mutter/issues/929
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326

 js/ui/workspaceAnimation.js | 45 ++++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js
index a46d94d9a2..b6d9994099 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -40,12 +40,21 @@ class WorkspaceGroup extends Clutter.Actor {
     }
 
     _syncStacking() {
-        const windowActors = global.get_window_actors();
-        let lastSibling = null;
+        // FIXME
+        this._removeWindows();
+        this._createWindows();
+        return;
+
+        const windowActors = global.get_window_actors().filter(w =>
+            this._shouldShowWindow(w.meta_window));
+
+        let lastRecord;
 
         for (const windowActor of windowActors) {
-            this.set_child_above_sibling(windowActor, lastSibling);
-            lastSibling = windowActor;
+            const record = this._windowRecords.find(r => r.windowActor === windowActor);
+
+            this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : null);
+            lastRecord = record;
         }
     }
 
@@ -54,16 +63,19 @@ class WorkspaceGroup extends Clutter.Actor {
             this._shouldShowWindow(w.meta_window));
 
         for (const windowActor of windowActors) {
-            const record = {
-                windowActor,
-                parent: windowActor.get_parent(),
-            };
+            const clone = new Clutter.Clone({
+                source: windowActor,
+                x: windowActor.x,
+                y: windowActor.y,
+            });
+
+            this.add_child(clone);
+            windowActor.hide();
 
-            record.parent.remove_child(windowActor);
-            this.add_child(windowActor);
-            windowActor.show();
+            const record = { windowActor, clone };
 
             record.windowDestroyId = windowActor.connect('destroy', () => {
+                clone.destroy();
                 this._windowRecords.splice(this._windowRecords.indexOf(record), 1);
             });
 
@@ -74,14 +86,13 @@ class WorkspaceGroup extends Clutter.Actor {
     _removeWindows() {
         for (const record of this._windowRecords) {
             record.windowActor.disconnect(record.windowDestroyId);
-            this.remove_child(record.windowActor);
-            record.parent.add_child(record.windowActor);
+            record.clone.destroy();
 
             // No workspace means we showed sticky windows,
-            // don't hide anything in this case
-            if (this._workspace &&
-                !record.windowActor.get_meta_window().get_workspace().active)
-                record.windowActor.hide();
+            // show them regardless of workspace
+            if (!this._workspace ||
+                record.windowActor.get_meta_window().get_workspace().active)
+                record.windowActor.show();
         }
 
         this._windowRecords = [];


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