[gnome-shell] layout: Move the keybinding mode to the user of PressureBarrier



commit df848aa084a76c459e4a18b1e64d0a507b55c120
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Mar 1 15:45:56 2013 -0500

    layout: Move the keybinding mode to the user of PressureBarrier
    
    For the hot corner case, we want to have the pressure apply both in
    and outside of the overview, so we need to move this to the user. At
    the same time, use keybinding mode math that's more like what's used
    in filterKeybinding.
    
    While it may seem like an abuse of the KeyBindingMode API, it may
    become more reasonable if one thinks of the pressure barrier as a
    binding of sorts, just applied to the mouse. If a ButtonBinding API
    was added to mutter, I think we'd use the existing KeyBindingMode
    infastructure there as well.

 js/ui/layout.js |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index e2691c0..29703c8 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -441,7 +441,11 @@ const LayoutManager = new Lang.Class({
                                                y1: monitor.y + monitor.height, y2: monitor.y + 
monitor.height,
                                                directions: Meta.BarrierDirection.NEGATIVE_Y });
 
-        this._trayPressure = new PressureBarrier(this._trayBarrier, MESSAGE_TRAY_PRESSURE_THRESHOLD, 
MESSAGE_TRAY_PRESSURE_TIMEOUT);
+        this._trayPressure = new PressureBarrier(this._trayBarrier,
+                                                 MESSAGE_TRAY_PRESSURE_THRESHOLD,
+                                                 MESSAGE_TRAY_PRESSURE_TIMEOUT,
+                                                 Shell.KeyBindingMode.NORMAL |
+                                                 Shell.KeyBindingMode.OVERVIEW);
         this._trayPressure.connect('trigger', function(barrier) {
             Main.messageTray.openTray();
         });
@@ -1258,10 +1262,11 @@ const HotCorner = new Lang.Class({
 const PressureBarrier = new Lang.Class({
     Name: 'PressureBarrier',
 
-    _init: function(barrier, threshold, timeout) {
+    _init: function(barrier, threshold, timeout, keybindingMode) {
         this._barrier = barrier;
         this._threshold = threshold;
         this._timeout = timeout;
+        this._keybindingMode = keybindingMode;
         this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : 
Clutter.Orientation.VERTICAL;
 
         this._isTriggered = false;
@@ -1344,11 +1349,8 @@ const PressureBarrier = new Lang.Class({
         if (event.grabbed && Main.modalCount == 0)
             return;
 
-        let isOverview = ((Main.keybindingMode & (Shell.KeyBindingMode.OVERVIEW)) != 0);
-
-        // Throw out events where the grab is taken by something that's
-        // not the overview (modal dialogs, etc.)
-        if (event.grabbed && !isOverview)
+        // Throw out all events not in the proper keybinding mode
+        if (!(this._keybindingMode & Main.keybindingMode))
             return;
 
         let slide = this._getDistanceAlongBarrier(event);


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