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



commit c9c7883742f2d25796b6e64ae011c31ab8e52ff2
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 0c1f40597f..52c6e44c99 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -48,16 +48,19 @@ class WorkspaceGroup extends Clutter.Actor {
             this._shouldShowWindow(w.meta_window));
 
         for (const windowActor of windows) {
-            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._windows.splice(this._windows.indexOf(record), 1);
             });
 
@@ -68,11 +71,10 @@ class WorkspaceGroup extends Clutter.Actor {
     _removeWindows() {
         for (const record of this._windows) {
             record.windowActor.disconnect(record.windowDestroyId);
-            this.remove_child(record.windowActor);
-            record.parent.add_child(record.windowActor);
+            record.clone.destroy();
 
-            if (!record.windowActor.get_meta_window().get_workspace().active)
-                record.windowActor.hide();
+            if (record.windowActor.get_meta_window().get_workspace().active)
+                record.windowActor.show();
         }
 
         this._windows = [];


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