[gnome-shell/wip/message-tray: 31/33] messageTray: Always close the tray when clicking outside of it
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/message-tray: 31/33] messageTray: Always close the tray when clicking outside of it
- Date: Thu, 16 Aug 2012 17:59:44 +0000 (UTC)
commit e8a5d8acf01439d4ee3711d5059a1daa79719947
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Aug 16 13:49:35 2012 -0400
messageTray: Always close the tray when clicking outside of it
Even when a summary box pointer item is up.
js/ui/grabHelper.js | 14 ++++++++++++--
js/ui/messageTray.js | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index 780377f..0a4ea97 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -83,7 +83,14 @@ const GrabHelper = new Lang.Class({
},
get currentGrab() {
- return this._grabStack[this._grabStack.length - 1] || {};
+ if (!this._grabStack.length)
+ return {};
+
+ let idx = this._grabStack.length - 1;
+ while (idx >= 0 && this._grabStack[idx].untracked)
+ idx--;
+
+ return this._grabStack[idx];
},
_findStackIndex: function(actor) {
@@ -131,10 +138,13 @@ const GrabHelper = new Lang.Class({
// revert it back, and re-focus the previously-focused window (if
// another window hasn't been explicitly focused before then).
//
- //
+ // If @params contains { untracked: true }, then it will be skipped
+ // when the grab helper ungrabs for you, or when calculating
+ // currentGrab.
grab: function(params) {
params = Params.parse(params, { actor: null,
modal: false,
+ untracked: false,
grabFocus: false,
onUngrab: null });
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 5820259..75b2f92 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -2175,6 +2175,7 @@ const MessageTray = new Lang.Class({
}
this._grabHelper.grab({ actor: this._summaryBoxPointer.bin.child,
+ untracked: true,
grabFocus: true,
onUngrab: Lang.bind(this, this._onSummaryBoxPointerUngrabbed) });
this._lock();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]