[gnome-shell/wip/message-tray: 16/24] messageTray: Make modal



commit f80f67f06d59ca66d7bd98355da01262af090baf
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Aug 10 17:03:12 2012 -0300

    messageTray: Make modal

 js/ui/messageTray.js |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 94240ef..8538281 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1861,10 +1861,14 @@ const MessageTray = new Lang.Class({
                       transition: 'easeOutQuad'
                     });
 
-        // Don't move the windows up if we are in the overview.
+        // Don't move the windows up and grab if we are in the overview.
         if (this._overviewVisible)
             return;
 
+        this._grabHelper.grab({ actor: this.actor,
+                                modal: true,
+                                onUngrab: Lang.bind(this, this._escapeTray) });
+
         let bottomMonitor = Main.layoutManager.bottomMonitor;
         let geometry = new Clutter.Geometry({ x: bottomMonitor.x,
                                               y: bottomMonitor.y,
@@ -1892,6 +1896,26 @@ const MessageTray = new Lang.Class({
     },
 
     _hideTray: function() {
+        // The flow in here is a bit tricky. If the actor is
+        // grabbed, that means that we hid the tray on our own
+        // from _updateState. In this case, we ungrab the actor,
+        // which triggers _escapeTray, which calls _updateState,
+        // which eventually sends us to the "else" path below.
+
+        // If we don't have a grab, we just tween the actor back
+        // immediately.
+
+        // This is complicated because we have cases where we
+        // don't always grab (the overview), and because of
+        // the fancy state machine logic.
+        if (this._grabHelper.isActorGrabbed(this.actor)) {
+            this._grabHelper.ungrab({ actor: this.actor });
+        } else {
+            this._tweenTrayHidden();
+        }
+    },
+
+    _tweenTrayHidden: function() {
         this._tween(this.actor, '_trayState', State.HIDDEN,
                     { y: 0,
                       time: ANIMATION_TIME,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]