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
This commit is contained in:
Dan Winship 2011-09-09 10:56:51 -04:00
parent a8fdcffd44
commit 33094b4988
2 changed files with 25 additions and 2 deletions

View File

@ -45,7 +45,9 @@ LayoutManager.prototype = {
this.trayBox.connect('allocation-changed', this.trayBox.connect('allocation-changed',
Lang.bind(this, this._updateTrayBarrier)); 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.addChrome(this.keyboardBox, { visibleInFullscreen: true });
this._keyboardHeightNotifyId = 0; this._keyboardHeightNotifyId = 0;

View File

@ -1396,12 +1396,15 @@ MessageTray.prototype = {
})); }));
this._focusGrabber.connect('escape-pressed', Lang.bind(this, this._escapeTray)); 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._trayState = State.HIDDEN;
this._locked = false; this._locked = false;
this._traySummoned = false; this._traySummoned = false;
this._useLongerTrayLeftTimeout = false; this._useLongerTrayLeftTimeout = false;
this._trayLeftTimeoutId = 0; this._trayLeftTimeoutId = 0;
this._pointerInTray = false; this._pointerInTray = false;
this._pointerInKeyboard = false;
this._summaryState = State.HIDDEN; this._summaryState = State.HIDDEN;
this._summaryTimeoutId = 0; this._summaryTimeoutId = 0;
this._pointerInSummary = false; 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) { _onStatusChanged: function(presence, status) {
this._backFromAway = (this._userStatus == GnomeSession.PresenceStatus.IDLE && this._userStatus != status); this._backFromAway = (this._userStatus == GnomeSession.PresenceStatus.IDLE && this._userStatus != status);
this._userStatus = status; this._userStatus = status;
@ -1915,7 +1936,7 @@ MessageTray.prototype = {
let notificationsPending = this._notificationQueue.length > 0 && (!this._busy || notificationUrgent); let notificationsPending = this._notificationQueue.length > 0 && (!this._busy || notificationUrgent);
let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved; let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
let notificationExpanded = this._notificationBin.y < 0; 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; let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN;
if (this._notificationState == State.HIDDEN) { if (this._notificationState == State.HIDDEN) {