[gnome-shell/wip/message-tray: 12/17] messageTray: Clone, clip & move the window_group instead of each actor



commit 3a5714a2dd0ed2b358ef0b56579a40ed145f358a
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Aug 6 23:14:06 2012 +0200

    messageTray: Clone, clip & move the window_group instead of each actor
    
    This way we can handle straddling windows better by clipping them at
    the monitor boundary.
    
    Always move the bottom monitor and not the primary, because that is
    where the tray is. To stop the wallpaper from the bottom monitor
    leaking into the primary, adjust the clip as the clone animates
    up/down.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681392

 js/ui/messageTray.js |   85 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 51 insertions(+), 34 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 385acf0..b57695d 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1502,6 +1502,7 @@ const MessageTray = new Lang.Class({
         this._notificationRemoved = false;
         this._reNotifyAfterHideNotification = null;
         this._inFullscreen = false;
+        this._desktopClone = null;
         this._tweening = 0;
         this._windowsShifted = 0;
 
@@ -2045,23 +2046,35 @@ const MessageTray = new Lang.Class({
         if (this._overviewVisible)
             return;
 
-        let actors = global.get_window_actors();
-        for (let i = 0; i < actors.length; i++) {
-            let window = actors[i].metaWindow;
-            if (!window.is_on_primary_monitor())
-                continue;
-
-            Tweener.addTween(actors[i],
-                             { y: actors[i].y - this.actor.height,
-                               time: ANIMATION_TIME,
-                               transition: 'easeOutQuad',
-                               onComplete: Lang.bind(this, function() {
-                                   this._tweening--;
-                               })
-                             });
-            this._windowsShifted++;
-            this._tweening++;
-        }
+        let bottomMonitor = Main.layoutManager.bottomMonitor;
+        let geometry = new Clutter.Geometry({ x: bottomMonitor.x,
+                                              y: bottomMonitor.y,
+                                              width: bottomMonitor.width,
+                                              height: bottomMonitor.height
+                                            });
+        this._desktopClone = new Clutter.Clone({ source: global.window_group, clip: geometry });
+        Main.uiGroup.insert_child_above(this._desktopClone, global.window_group);
+        this._desktopClone.x = 0;
+        this._desktopClone.y = 0;
+        this._desktopClone.show();
+
+        Tweener.addTween(this._desktopClone,
+                         { y: this._desktopClone.y - this.actor.height,
+                           time: ANIMATION_TIME,
+                           transition: 'easeOutQuad',
+                           onComplete: Lang.bind(this, function() {
+                               this._tweening--;
+                           }),
+                           onUpdate: Lang.bind(this, function() {
+                               let progress = -1 * this._desktopClone.y;
+                               this._desktopClone.set_clip(geometry.x,
+                                                           geometry.y + progress,
+                                                           geometry.width,
+                                                           geometry.height - progress);
+                           })
+                         });
+        this._windowsShifted++;
+        this._tweening++;
     },
 
     _hideTray: function() {
@@ -2088,23 +2101,27 @@ const MessageTray = new Lang.Class({
         if (this._windowsShifted == 0)
             return;
 
-        let actors = global.get_window_actors();
-        for (let i = 0; i < actors.length; i++) {
-            let window = actors[i].metaWindow;
-            if (!window.is_on_primary_monitor())
-                continue;
-
-            Tweener.addTween(actors[i],
-                             { y: actors[i].y + this.actor.height,
-                               time: ANIMATION_TIME,
-                               transition: 'easeOutQuad',
-                               onComplete: Lang.bind(this, function() {
-                                   this._windowsShifted--;
-                                   this._tweening--;
-                               })
-                             });
-            this._tweening++;
-        }
+        let geometry = this._desktopClone.clip;
+        Tweener.addTween(this._desktopClone,
+                         { y: this._desktopClone.y + this.actor.height,
+                           time: ANIMATION_TIME,
+                           transition: 'easeOutQuad',
+                           onComplete: Lang.bind(this, function() {
+                               this._windowsShifted--;
+                               this._tweening--;
+                               this._desktopClone.hide();
+                               Main.uiGroup.remove_actor(this._desktopClone);
+                               this._desktopClone = null;
+                           }),
+                           onUpdate: Lang.bind(this, function() {
+                               let progress = this.actor.height + this._desktopClone.y; // y is -ve
+                               this._desktopClone.set_clip(geometry.x,
+                                                           geometry.y - progress,
+                                                           geometry.width,
+                                                           geometry.height + progress);
+                           })
+                         });
+        this._tweening++;
     },
 
     _onIdleMonitorWatch: function(monitor, id, userBecameIdle) {



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