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



commit 0dc79c8d7dfa055671abd11908f31e5a99802f75
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.
    
    Fixes: https://bugzilla.gnome.org/677215

 js/ui/messageTray.js |   86 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 52 insertions(+), 34 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 4d00b12..42080c1 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1500,6 +1500,7 @@ const MessageTray = new Lang.Class({
         this._notificationRemoved = false;
         this._reNotifyAfterHideNotification = null;
         this._inFullscreen = false;
+        this._desktopClone = null;
         this._tweening = 0;
         this._windowsShifted = 0;
 
@@ -2035,23 +2036,36 @@ 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.add_actor(this._desktopClone);
+        this._desktopClone.x = 0;
+        this._desktopClone.y = 0;
+        this._desktopClone.raise(global.window_group);
+        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() {
@@ -2078,23 +2092,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]