[gnome-shell/wip/fmuellner/notification-redux+sass: 131/145] Misc. message tray stuff



commit b1a4bbcc6243b95651ab45e1880258e13412f162
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 19 11:02:44 2015 +0100

    Misc. message tray stuff
    
    This reverts commit 975a6c6a724183eff5622baa20ab1ad5083006ef.
    
    mt experiment
    
    Revert "mt experiment"
    
    This reverts commit c6424514823adb705ee1568933d90695b7df1b43.

 js/ui/messageTray.js |   84 ++++++++++++++++---------------------------------
 1 files changed, 28 insertions(+), 56 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 762701f..4db787a 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1464,20 +1464,16 @@ const MessageTray = new Lang.Class({
         }));
 
         this.actor = new St.Widget({ name: 'notification-container',
-                                     reactive: true,
-                                     track_hover: true,
-                                     y_align: Clutter.ActorAlign.START,
-                                     x_align: Clutter.ActorAlign.CENTER,
-                                     y_expand: true,
-                                     x_expand: true,
+                                     clip_to_allocation: true,
+                                     x_expand: true, y_expand: true,
                                      layout_manager: new Clutter.BinLayout() });
         this.actor.connect('key-release-event', Lang.bind(this, this._onNotificationKeyRelease));
-        this.actor.connect('notify::hover', Lang.bind(this, this._onNotificationHoverChanged));
 
-        this._notificationBin = new St.Bin({ y_expand: true });
+        this._notificationBin = new St.Bin({ reactive: true, track_hover: true, x_expand: true, y_expand: 
true });
+        this._notificationBin.connect('notify::hover', Lang.bind(this, this._onNotificationHoverChanged));
+        this._notificationBin.set_x_align(Clutter.ActorAlign.CENTER);
         this._notificationBin.set_y_align(Clutter.ActorAlign.START);
         this.actor.add_actor(this._notificationBin);
-        this.actor.hide();
         this._notificationFocusGrabber = new FocusGrabber(this.actor);
         this._notificationQueue = [];
         this._notification = null;
@@ -1509,6 +1505,7 @@ const MessageTray = new Lang.Class({
 
         Main.layoutManager.trayBox.add_actor(this.actor);
         Main.layoutManager.trackChrome(this.actor);
+        Main.layoutManager.trackChrome(this._notificationBin);
 
         global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState));
 
@@ -1667,10 +1664,10 @@ const MessageTray = new Lang.Class({
     },
 
     _onNotificationHoverChanged: function() {
-        if (this.actor.hover == this._notificationHovered)
+        if (this._notificationBin.hover == this._notificationHovered)
             return;
 
-        this._notificationHovered = this.actor.hover;
+        this._notificationHovered = this._notificationBin.hover;
         if (this._notificationHovered) {
             this._resetNotificationLeftTimeout();
 
@@ -1727,11 +1724,11 @@ const MessageTray = new Lang.Class({
 
     _onNotificationLeftTimeout: function() {
         let [x, y, mods] = global.get_pointer();
-        // We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to 
either side or up.
+        // We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to 
either side or down.
         // We don't check how far down the mouse moved because any point above the tray, but below the exit 
coordinate,
         // is close to the tray.
         if (this._notificationLeftMouseX > -1 &&
-            y > this._notificationLeftMouseY - MOUSE_LEFT_ACTOR_THRESHOLD &&
+            y < this._notificationLeftMouseY + MOUSE_LEFT_ACTOR_THRESHOLD &&
             x < this._notificationLeftMouseX + MOUSE_LEFT_ACTOR_THRESHOLD &&
             x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) {
             this._notificationLeftMouseX = -1;
@@ -1854,9 +1851,7 @@ const MessageTray = new Lang.Class({
         }));
         this._notificationBin.child = this._notification.actor;
 
-        this.actor.opacity = 0;
-        this.actor.y = 0;
-        this.actor.show();
+        this._notificationBin.y = -this._notification.actor.height;
 
         this._updateShowingNotification();
 
@@ -1898,15 +1893,19 @@ const MessageTray = new Lang.Class({
         // We use this._showNotificationCompleted() onComplete callback to extend the time the updated
         // notification is being shown.
 
-        let tweenParams = { opacity: 255,
-                            y: -this.actor.height,
+        Tweener.addTween(this._notificationBin,
+                         { opacity: 255,
+                           time: ANIMATION_TIME,
+                           transition: 'easeOutQuad' });
+
+        let tweenParams = { y: 0,
                             time: ANIMATION_TIME,
-                            transition: 'easeOutQuad',
+                            transition: 'easeOutBack',
                             onComplete: this._showNotificationCompleted,
                             onCompleteScope: this
                           };
 
-        this._tween(this.actor, '_notificationState', State.SHOWN, tweenParams);
+        this._tween(this._notificationBin, '_notificationState', State.SHOWN, tweenParams);
    },
 
     _showNotificationCompleted: function() {
@@ -1970,18 +1969,20 @@ const MessageTray = new Lang.Class({
         this._resetNotificationLeftTimeout();
 
         if (animate) {
-            this._tween(this.actor, '_notificationState', State.HIDDEN,
-                        { y: 0,
-                          opacity: 0,
+            Tweener.addTween(this._notificationBin,
+                             { opacity: 0,
+                               time: ANIMATION_TIME,
+                               transition: 'easeOutQuad' });
+            this._tween(this._notificationBin, '_notificationState', State.HIDDEN,
+                        { y: -this._notificationBin.height,
                           time: ANIMATION_TIME,
-                          transition: 'easeOutQuad',
+                          transition: 'easeOutBack',
                           onComplete: this._hideNotificationCompleted,
                           onCompleteScope: this
                         });
         } else {
-            Tweener.removeTweens(this.actor);
-            this.actor.y = 0;
-            this.actor.opacity = 0;
+            Tweener.removeTweens(this._notificationBin);
+            this._notificationBin.y = -this._notificationBin.height;
             this._notificationState = State.HIDDEN;
             this._hideNotificationCompleted();
         }
@@ -1998,7 +1999,6 @@ const MessageTray = new Lang.Class({
         this._pointerInNotification = false;
         this._notificationRemoved = false;
         this._notificationBin.child = null;
-        this.actor.hide();
     },
 
     _expandActiveNotification: function() {
@@ -2009,10 +2009,6 @@ const MessageTray = new Lang.Class({
     },
 
     _expandNotification: function(autoExpanding) {
-        if (!this._notificationExpandedId)
-            this._notificationExpandedId =
-                this._notification.connect('expanded',
-                                           Lang.bind(this, this._onNotificationExpanded));
         // Don't animate changes in notifications that are auto-expanding.
         this._notification.expand(!autoExpanding);
 
@@ -2021,30 +2017,6 @@ const MessageTray = new Lang.Class({
             this._ensureNotificationFocused();
     },
 
-    _onNotificationExpanded: function() {
-        let expandedY = - this.actor.height;
-
-        // Don't animate the notification to its new position if it has shrunk:
-        // there will be a very visible "gap" that breaks the illusion.
-        if (this.actor.y < expandedY) {
-            this.actor.y = expandedY;
-        } else if (this._notification.y != expandedY) {
-            // Tween also opacity here, to override a possible tween that's
-            // currently hiding the notification.
-            Tweener.addTween(this.actor,
-                             { y: expandedY,
-                               opacity: 255,
-                               time: ANIMATION_TIME,
-                               transition: 'easeOutQuad',
-                               // HACK: Drive the state machine here better,
-                               // instead of overwriting tweens
-                               onComplete: Lang.bind(this, function() {
-                                   this._notificationState = State.SHOWN;
-                               }),
-                             });
-        }
-    },
-
     _ensureNotificationFocused: function() {
         this._notificationFocusGrabber.grabFocus();
     }


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