[gnome-shell] Don't reset y position of expanded notifications when updating them



commit cb4c2ab8245ffcb36144d137ec30bcc19af14282
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date:   Wed Jan 12 20:05:36 2011 -0500

    Don't reset y position of expanded notifications when updating them
    
    This fixes the problem of chat notifications collapsing and then expanding
    again when receiving multiple messages in the expanded new notification.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629557

 js/ui/messageTray.js |   43 ++++++++++++++++++++++++++++++-------------
 1 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 1e896a9..c158c03 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1500,23 +1500,40 @@ MessageTray.prototype = {
 
     _updateShowingNotification: function() {
         Tweener.removeTweens(this._notificationBin);
-        this._tween(this._notificationBin, '_notificationState', State.SHOWN,
-                    { y: 0,
-                      opacity: 255,
-                      time: ANIMATION_TIME,
-                      transition: 'easeOutQuad',
-                      onComplete: this._showNotificationCompleted,
-                      onCompleteScope: this
-                    });
 
         // We auto-expand notifications with CRITICAL urgency.
-        // We call _expandNotification() again on the notifications that
-        // are expanded in case they were in the process of hiding and need
-        // to re-expand.
+        // We use Tweener.removeTweens() to remove a tween that was hiding the notification we are
+        // updating, in case that notification was in the process of being hidden. However,
+        // Tweener.removeTweens() would also remove a tween that was updating the position of the
+        // notification we are updating, in case that notification was already expanded and its height
+        // changed. Therefore we need to call this._expandNotification() for expanded notifications
+        // to make sure their position is updated.
         if (this._notification.urgency == Urgency.CRITICAL || this._notification.expanded)
-            // This will overwrite the y tween, but leave the opacity
-            // tween, and so the onComplete will remain as well.
             this._expandNotification(true);
+
+        // We tween all notifications to full opacity. This ensures that both new notifications and
+        // notifications that might have been in the process of hiding get full opacity.
+        //
+        // We tween any notification showing in the banner mode to banner height (this._notificationBin.y = 0).
+        // This ensures that both new notifications and notifications in the banner mode that might
+        // have been in the process of hiding are shown with the banner height.
+        //
+        // We use this._showNotificationCompleted() onComplete callback to extend the time the updated
+        // notification is being shown.
+        //
+        // We don't set the y parameter for the tween for expanded notifications because
+        // this._expandNotification() will result in getting this._notificationBin.y set to the appropriate
+        // fully expanded value.
+        let tweenParams = { opacity: 255,
+                            time: ANIMATION_TIME,
+                            transition: 'easeOutQuad',
+                            onComplete: this._showNotificationCompleted,
+                            onCompleteScope: this
+                          };
+        if (!this._notification.expanded)
+            tweenParams.y = 0;
+
+        this._tween(this._notificationBin, '_notificationState', State.SHOWN, tweenParams);
    },
 
     _showNotificationCompleted: function() {



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