[gnome-shell] MessageTray: don't destroy notifications when the user presses ESC



commit 057a026ea42a9bd0ed21d953134647de046e8927
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Feb 26 14:44:53 2014 +0100

    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

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


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