[gnome-shell/wip/message-tray: 21/23] messageTray: Always close the tray when clicking outside of it



commit 42adc0db0ae92a0f17b5823f71278caf3a952dfd
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 e53b604..b5d0b0b 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -2213,6 +2213,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]