messageTray: Clean up the code that animates the notification
Right now the code chooses to animate based on whether or not the notification was "removed", which is quite a sketchy subject. For now, add an additional case so that we don't animate when we transition to the lock screen.
This commit is contained in:
parent
12b7e56261
commit
3cb809b444
@ -2250,26 +2250,27 @@ const MessageTray = new Lang.Class({
|
|||||||
let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
|
let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null;
|
||||||
let notificationPinned = this._pointerInNotification && !this._notificationRemoved;
|
let notificationPinned = this._pointerInNotification && !this._notificationRemoved;
|
||||||
let notificationExpanded = this._notification && this._notification.expanded;
|
let notificationExpanded = this._notification && this._notification.expanded;
|
||||||
let notificationExpired = this._notificationTimeoutId == 0 &&
|
let notificationExpired = (this._userActiveWhileNotificationShown &&
|
||||||
!(this._notification && this._notification.urgency == Urgency.CRITICAL) &&
|
this._notificationTimeoutId == 0 &&
|
||||||
!(this._notification && this._notification.focused) &&
|
!(this._notification && this._notification.urgency == Urgency.CRITICAL) &&
|
||||||
!this._pointerInNotification;
|
!(this._notification && this._notification.focused) &&
|
||||||
|
!this._pointerInNotification);
|
||||||
let notificationLockedOut = !hasNotifications && this._notification;
|
let notificationLockedOut = !hasNotifications && this._notification;
|
||||||
let notificationMustClose = (this._notificationRemoved || notificationLockedOut ||
|
let notificationMustClose = (this._notificationRemoved || notificationLockedOut || notificationExpired || this._traySummoned);
|
||||||
(notificationExpired && this._userActiveWhileNotificationShown) ||
|
|
||||||
this._traySummoned);
|
|
||||||
let canShowNotification = notificationsPending && this._trayState == State.HIDDEN && !this._traySummoned;
|
let canShowNotification = notificationsPending && this._trayState == State.HIDDEN && !this._traySummoned;
|
||||||
|
|
||||||
if (this._notificationState == State.HIDDEN) {
|
if (this._notificationState == State.HIDDEN) {
|
||||||
if (canShowNotification)
|
if (canShowNotification)
|
||||||
this._showNotification();
|
this._showNotification();
|
||||||
} else if (this._notificationState == State.SHOWN) {
|
} else if (this._notificationState == State.SHOWN) {
|
||||||
if (notificationMustClose)
|
if (notificationMustClose) {
|
||||||
this._hideNotification();
|
let animate = !(this._notificationRemoved || notificationLockedOut);
|
||||||
else if (notificationPinned && !notificationExpanded)
|
this._hideNotification(animate);
|
||||||
|
} else if (notificationPinned && !notificationExpanded) {
|
||||||
this._expandNotification(false);
|
this._expandNotification(false);
|
||||||
else if (notificationPinned)
|
} else if (notificationPinned) {
|
||||||
this._ensureNotificationFocused();
|
this._ensureNotificationFocused();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Summary notification
|
// Summary notification
|
||||||
@ -2549,7 +2550,7 @@ const MessageTray = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideNotification: function() {
|
_hideNotification: function(animate) {
|
||||||
this._notificationFocusGrabber.ungrabFocus();
|
this._notificationFocusGrabber.ungrabFocus();
|
||||||
|
|
||||||
if (this._notificationExpandedId) {
|
if (this._notificationExpandedId) {
|
||||||
@ -2573,13 +2574,7 @@ const MessageTray = new Lang.Class({
|
|||||||
this._notificationLeftMouseY = -1;
|
this._notificationLeftMouseY = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._notificationRemoved) {
|
if (animate) {
|
||||||
Tweener.removeTweens(this._notificationWidget);
|
|
||||||
this._notificationWidget.y = this.actor.height;
|
|
||||||
this._notificationWidget.opacity = 0;
|
|
||||||
this._notificationState = State.HIDDEN;
|
|
||||||
this._hideNotificationCompleted();
|
|
||||||
} else {
|
|
||||||
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
|
this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
|
||||||
{ y: this.actor.height,
|
{ y: this.actor.height,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
@ -2588,7 +2583,12 @@ const MessageTray = new Lang.Class({
|
|||||||
onComplete: this._hideNotificationCompleted,
|
onComplete: this._hideNotificationCompleted,
|
||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Tweener.removeTweens(this._notificationWidget);
|
||||||
|
this._notificationWidget.y = this.actor.height;
|
||||||
|
this._notificationWidget.opacity = 0;
|
||||||
|
this._notificationState = State.HIDDEN;
|
||||||
|
this._hideNotificationCompleted();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user