MessageTray: don't destroy notifications when the user presses ESC

Doing so is inconsistent with the behavior in the summary, and
is quite annoying when dealing with chats (because there is no way
to unfocus a chat notification with the keyboard only)

https://bugzilla.gnome.org/show_bug.cgi?id=724178
This commit is contained in:
Giovanni Campagna 2014-02-26 14:44:53 +01:00
parent 6ce6e86318
commit 057a026ea4

View File

@ -2027,13 +2027,18 @@ const MessageTray = new Lang.Class({
_onNotificationKeyRelease: function(actor, event) { _onNotificationKeyRelease: function(actor, event) {
if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) { if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) {
this._closeNotification(); this._expireNotification();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
}, },
_expireNotification: function() {
this._notificationExpired = true;
this._updateState();
},
_closeNotification: function() { _closeNotification: function() {
if (this._notificationState == State.SHOWN) { if (this._notificationState == State.SHOWN) {
this._closeButton.hide(); this._closeButton.hide();
@ -2398,7 +2403,7 @@ const MessageTray = new Lang.Class({
this._notificationTimeoutId == 0 && this._notificationTimeoutId == 0 &&
this._notification.urgency != Urgency.CRITICAL && this._notification.urgency != Urgency.CRITICAL &&
!this._notification.focused && !this._notification.focused &&
!this._pointerInNotification); !this._pointerInNotification) || this._notificationExpired;
let mustClose = (this._notificationRemoved || !hasNotifications || expired || this._traySummoned); let mustClose = (this._notificationRemoved || !hasNotifications || expired || this._traySummoned);
if (mustClose) { if (mustClose) {
@ -2459,6 +2464,10 @@ const MessageTray = new Lang.Class({
this._hideDesktopClone(); this._hideDesktopClone();
this._updatingState = false; this._updatingState = false;
// Clean transient variables that are used to communicate actions
// to updateState()
this._notificationExpired = false;
}, },
_tween: function(actor, statevar, value, params) { _tween: function(actor, statevar, value, params) {