[gnome-shell] messageTray: fix notification/keyboard interaction



commit 33094b4988299d69b4f184d708c2f6e7021c2279
Author: Dan Winship <danw gnome org>
Date:   Fri Sep 9 10:56:51 2011 -0400

    messageTray: fix notification/keyboard interaction
    
    If the pointer moves from the notification into the keyboard, don't
    treat that as moving out of the tray.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658603

 js/ui/layout.js      |    4 +++-
 js/ui/messageTray.js |   23 ++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 72608d3..d473ae0 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -45,7 +45,9 @@ LayoutManager.prototype = {
         this.trayBox.connect('allocation-changed',
                              Lang.bind(this, this._updateTrayBarrier));
 
-        this.keyboardBox = new St.BoxLayout({ name: 'keyboardBox' });
+        this.keyboardBox = new St.BoxLayout({ name: 'keyboardBox',
+                                              reactive: true,
+                                              track_hover: true });
         this.addChrome(this.keyboardBox, { visibleInFullscreen: true });
         this._keyboardHeightNotifyId = 0;
 
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index f027487..fcf2f42 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1396,12 +1396,15 @@ MessageTray.prototype = {
            }));
         this._focusGrabber.connect('escape-pressed', Lang.bind(this, this._escapeTray));
 
+        Main.layoutManager.keyboardBox.connect('notify::hover', Lang.bind(this, this._onKeyboardHoverChanged));
+
         this._trayState = State.HIDDEN;
         this._locked = false;
         this._traySummoned = false;
         this._useLongerTrayLeftTimeout = false;
         this._trayLeftTimeoutId = 0;
         this._pointerInTray = false;
+        this._pointerInKeyboard = false;
         this._summaryState = State.HIDDEN;
         this._summaryTimeoutId = 0;
         this._pointerInSummary = false;
@@ -1851,6 +1854,24 @@ MessageTray.prototype = {
         }
     },
 
+    _onKeyboardHoverChanged: function(keyboard) {
+        this._pointerInKeyboard = keyboard.hover;
+
+        if (!keyboard.hover) {
+            let event = Clutter.get_current_event();
+            if (event && event.type() == Clutter.EventType.LEAVE) {
+                let into = event.get_related();
+                if (into && this.actor.contains(into)) {
+                    // Don't call _updateState, because pointerInTray is
+                    // still false
+                    return;
+                }
+            }
+        }
+
+        this._updateState();
+    },
+
     _onStatusChanged: function(presence, status) {
         this._backFromAway = (this._userStatus == GnomeSession.PresenceStatus.IDLE && this._userStatus != status);
         this._userStatus = status;
@@ -1915,7 +1936,7 @@ MessageTray.prototype = {
         let notificationsPending = this._notificationQueue.length > 0 && (!this._busy || notificationUrgent);
         let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
         let notificationExpanded = this._notificationBin.y < 0;
-        let notificationExpired = (this._notificationTimeoutId == 0 && !(this._notification && this._notification.urgency == Urgency.CRITICAL) && !this._pointerInTray && !this._locked) || this._notificationRemoved;
+        let notificationExpired = (this._notificationTimeoutId == 0 && !(this._notification && this._notification.urgency == Urgency.CRITICAL) && !this._pointerInTray && !this._locked && !(this._pointerInKeyboard && notificationExpanded)) || this._notificationRemoved;
         let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN;
 
         if (this._notificationState == State.HIDDEN) {



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