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



commit 67aff307a6db138a6cfec652c56ba76d390c1fa0
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 | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js
index dde1d50629..e27bc192c8 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -49,16 +49,19 @@ class WorkspaceGroup extends Clutter.Actor {
         windows = windows.filter(w => this._shouldShowWindow(w.meta_window));
 
         for (let window of windows) {
-            let record = {
-                window,
-                parent: window.get_parent(),
-            };
+            let clone = new Clutter.Clone({
+                source: window,
+                x: window.x,
+                y: window.y,
+            });
+
+            this.add_actor(clone);
+            window.hide();
 
-            record.parent.remove_child(window);
-            this.add_child(window);
-            window.show();
+            let record = { window, clone };
 
             record.windowDestroyId = window.connect('destroy', () => {
+                clone.destroy();
                 this._windows.splice(this._windows.indexOf(record), 1);
             });
 
@@ -71,11 +74,10 @@ class WorkspaceGroup extends Clutter.Actor {
             let w = this._windows[i];
 
             w.window.disconnect(w.windowDestroyId);
-            this.remove_child(w.window);
-            w.parent.add_child(w.window);
+            w.clone.destroy();
 
-            if (!w.window.get_meta_window().get_workspace().active)
-                w.window.hide();
+            if (w.window.get_meta_window().get_workspace().active)
+                w.window.show();
         }
 
         this._windows = [];


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