[gnome-shell] MessageTray: fix showing and hiding summary notifications when summary items are clicked
- From: Marina Zhurakhinskaya <marinaz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] MessageTray: fix showing and hiding summary notifications when summary items are clicked
- Date: Tue, 15 Feb 2011 23:39:24 +0000 (UTC)
commit 1aba99336ad51c9bf95ef088f231410187f993d5
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date: Tue Feb 15 18:37:33 2011 -0500
MessageTray: fix showing and hiding summary notifications when summary items are clicked
This patch fixes the summary notification reappearing if you click on the
summary item to hide it and hover away. It also ensures that when you click
on any summary item which doesn't correspond to the summary notification
being shown, a new summary notification will replace it right away.
What used to happen is that we'd unset the clicked item in _unlock() that
was called when the focus was ungrabbed because the user clicked outside
of the summary notification, but then would have this._clickedSummaryItem
be null in _onSummaryItemClicked() , and set it to the clicked item all
over again. This patch ensures that we unset the clicked item only when
it is necessary.
We also needed to add the code to call _updateState() again to show a new
summary notification when a previous one was hidden, but
this._clickedSummaryItem was set.
https://bugzilla.gnome.org/show_bug.cgi?id=642005
js/ui/messageTray.js | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index cd062b3..3450b19 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -261,7 +261,7 @@ FocusGrabber.prototype = {
switch (event.type()) {
case Clutter.EventType.BUTTON_PRESS:
if (!this.actor.contains(source))
- this.ungrabFocus();
+ this.emit('button-pressed', source);
break;
case Clutter.EventType.KEY_PRESS:
let symbol = event.get_key_symbol();
@@ -991,6 +991,12 @@ MessageTray.prototype = {
this._lock();
}));
this._focusGrabber.connect('focus-ungrabbed', Lang.bind(this, this._unlock));
+ this._focusGrabber.connect('button-pressed', Lang.bind(this,
+ function(focusGrabber, source) {
+ if (this._clickedSummaryItem && !this._clickedSummaryItem.actor.contains(source))
+ this._unsetClickedSummaryItem();
+ this._focusGrabber.ungrabFocus();
+ }));
this._focusGrabber.connect('escape-pressed', Lang.bind(this, this._escapeTray));
this._trayState = State.HIDDEN;
@@ -1023,18 +1029,22 @@ MessageTray.prototype = {
Main.overview.connect('showing', Lang.bind(this,
function() {
this._overviewVisible = true;
- if (this._locked)
+ if (this._locked) {
+ this._unsetClickedSummaryItem();
this._unlock();
- else
+ } else {
this._updateState();
+ }
}));
Main.overview.connect('hiding', Lang.bind(this,
function() {
this._overviewVisible = false;
- if (this._locked)
+ if (this._locked) {
+ this._unsetClickedSummaryItem();
this._unlock();
- else
+ } else {
this._updateState();
+ }
}));
this._summaryItems = [];
@@ -1206,7 +1216,6 @@ MessageTray.prototype = {
if (!this._locked)
return;
this._locked = false;
- this._unsetClickedSummaryItem();
this._updateState();
},
@@ -1839,6 +1848,8 @@ MessageTray.prototype = {
this._onNotify(summaryNotification.source, summaryNotification);
this._reNotifyWithSummaryNotificationAfterHide = false;
}
+ if (this._clickedSummaryItem)
+ this._updateState();
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]