[gnome-shell] [MessageTray] don't time out the tray if the user is mousing towards it



commit 024ab39c6d1d23887411da7117a721f2ec0733e4
Author: Dan Winship <danw gnome org>
Date:   Thu Apr 29 15:06:51 2010 -0400

    [MessageTray] don't time out the tray if the user is mousing towards it
    
    If a notification is about to hide, but the user has moved the mouse
    towards it, let it stick around for another second (and so on, until
    the mouse either reaches the tray and causes it to be pinned, or stops
    moving the mouse toward it).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=610071

 js/ui/messageTray.js |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index df695e8..a9c58c0 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -820,6 +820,9 @@ MessageTray.prototype = {
             // tween, and so the onComplete will remain as well.
             this._expandNotification();
         }
+
+        let [x, y, mods] = global.get_pointer();
+        this._lastSeenMouseY = y;
     },
 
     _showNotificationCompleted: function() {
@@ -829,8 +832,21 @@ MessageTray.prototype = {
     },
 
     _notificationTimeout: function() {
-        this._notificationTimeoutId = 0;
-        this._updateState();
+        let [x, y, mods] = global.get_pointer();
+        if (y > this._lastSeenMouseY + 10 && y < this.actor.y) {
+            // The mouse is moving towards the notification, so don't
+            // hide it yet. (We just create a new timeout (and destroy
+            // the old one) each time because the bookkeeping is
+            // simpler.)
+            this._lastSeenMouseY = y;
+            this._notificationTimeoutId =
+                Mainloop.timeout_add(1000,
+                                     Lang.bind(this, this._notificationTimeout));
+        } else {
+            this._notificationTimeoutId = 0;
+            this._updateState();
+        }
+
         return false;
     },
 



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