[gnome-shell] messageTray: Fix some artifacts when tweening back from the tray



commit 9fac285b69148e71d9079c3bf0378aaff0eca02b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Oct 2 19:14:14 2012 -0300

    messageTray: Fix some artifacts when tweening back from the tray
    
    The math to calculate the clip isn't quite right here -- it overcompensates
    in the Y value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685341

 js/ui/messageTray.js |   40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 8b27d3d..5e92141 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -2094,16 +2094,25 @@ const MessageTray = new Lang.Class({
         return true;
     },
 
+    _updateDesktopCloneClip: function() {
+        let geometry = this._bottomMonitorGeometry;
+        let progress = -Math.round(this._desktopClone.y);
+        this._desktopClone.set_clip(geometry.x,
+                                    geometry.y + progress,
+                                    geometry.width,
+                                    geometry.height - progress);
+    },
+
     _showDesktopClone: function() {
         let bottomMonitor = Main.layoutManager.bottomMonitor;
-        let geometry = new Clutter.Geometry({ x: bottomMonitor.x,
-                                              y: bottomMonitor.y,
-                                              width: bottomMonitor.width,
-                                              height: bottomMonitor.height
-                                            });
+        this._bottomMonitorGeometry = { x: bottomMonitor.x,
+                                        y: bottomMonitor.y,
+                                        width: bottomMonitor.width,
+                                        height: bottomMonitor.height };
+
         if (this._desktopClone)
             this._desktopClone.destroy();
-        this._desktopClone = new Clutter.Clone({ source: global.window_group, clip: geometry });
+        this._desktopClone = new Clutter.Clone({ source: global.window_group, clip: new Clutter.Geometry(this._bottomMonitorGeometry) });
         Main.uiGroup.insert_child_above(this._desktopClone, global.window_group);
         this._desktopClone.x = 0;
         this._desktopClone.y = 0;
@@ -2113,13 +2122,7 @@ const MessageTray = new Lang.Class({
                     { y: -this.actor.height,
                       time: ANIMATION_TIME,
                       transition: 'easeOutQuad',
-                      onUpdate: function() {
-                          let progress = Math.round(-this.y);
-                          this.set_clip(geometry.x,
-                                        geometry.y + progress,
-                                        geometry.width,
-                                        geometry.height - progress);
-                      }
+                      onUpdate: Lang.bind(this, this._updateDesktopCloneClip)
                     });
     },
 
@@ -2142,10 +2145,10 @@ const MessageTray = new Lang.Class({
             this._desktopClone.destroy();
             this._desktopClone = null;
             this._desktopCloneState = State.HIDDEN;
+            this._bottomMonitorGeometry = null;
             return;
         }
 
-        let geometry = this._desktopClone.clip;
         this._tween(this._desktopClone, '_desktopCloneState', State.HIDDEN,
                     { y: 0,
                       time: ANIMATION_TIME,
@@ -2153,14 +2156,9 @@ const MessageTray = new Lang.Class({
                       onComplete: Lang.bind(this, function() {
                           this._desktopClone.destroy();
                           this._desktopClone = null;
+                          this._bottomMonitorGeometry = null;
                       }),
-                      onUpdate: function() {
-                          let progress = Math.round(-this.y);
-                          this.set_clip(geometry.x,
-                                        geometry.y - progress,
-                                        geometry.width,
-                                        geometry.height + progress);
-                      }
+                      onUpdate: Lang.bind(this, this._updateDesktopCloneClip)
                     });
     },
 



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