[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
This commit is contained in:
Dan Winship 2010-04-29 15:06:51 -04:00
parent 1210a78193
commit 024ab39c6d

View File

@ -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;
},