[gnome-shell] layout: Move tray-specific event filtration to the user of PressureBarrier



commit 337d2da38a9fb4caadf9d478c38730ee67dedccd
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Mar 1 15:33:39 2013 -0500

    layout: Move tray-specific event filtration to the user of PressureBarrier
    
    For the HotCorner, we want to have different logic for tossing out
    specific events based on the grabbed state, etc. so make us have
    to pass in an event filter callback.

 js/ui/layout.js |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 29703c8..7020c30 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -446,11 +446,22 @@ const LayoutManager = new Lang.Class({
                                                  MESSAGE_TRAY_PRESSURE_TIMEOUT,
                                                  Shell.KeyBindingMode.NORMAL |
                                                  Shell.KeyBindingMode.OVERVIEW);
+        this._trayPressure.setEventFilter(this._trayBarrierEventFilter);
         this._trayPressure.connect('trigger', function(barrier) {
             Main.messageTray.openTray();
         });
     },
 
+    _trayBarrierEventFilter: function(event) {
+        // Throw out all events where the pointer was grabbed by another
+        // client, as the client that grabbed the pointer expects to have
+        // complete control over it
+        if (event.grabbed && Main.modalCount == 0)
+            return true;
+
+        return false;
+    },
+
     _monitorsChanged: function() {
         this._updateMonitors();
         this._updateBoxes();
@@ -1268,6 +1279,7 @@ const PressureBarrier = new Lang.Class({
         this._timeout = timeout;
         this._keybindingMode = keybindingMode;
         this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : 
Clutter.Orientation.VERTICAL;
+        this._eventFilter = null;
 
         this._isTriggered = false;
         this._reset();
@@ -1282,6 +1294,10 @@ const PressureBarrier = new Lang.Class({
         this._barrier = null;
     },
 
+    setEventFilter: function(filter) {
+        this._eventFilter = filter;
+    },
+
     _reset: function() {
         this._barrierEvents = [];
         this._currentPressure = 0;
@@ -1343,10 +1359,7 @@ const PressureBarrier = new Lang.Class({
         if (this._isTriggered)
             return;
 
-        // Throw out all events where the pointer was grabbed by another
-        // client, as the client that grabbed the pointer expects to have
-        // complete control over it
-        if (event.grabbed && Main.modalCount == 0)
+        if (this._eventFilter && this._eventFilter(event))
             return;
 
         // Throw out all events not in the proper keybinding mode


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