[gnome-shell] layout: Trigger the tray if one event passes the threshold



commit 41f14e0e897b60cadd218538e4953c5ce2e5d2d2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 21 17:21:25 2013 -0500

    layout: Trigger the tray if one event passes the threshold
    
    As a special-case to the "cap event" rules, this allows a heavy swipe
    from top to bottom to allow triggering the tray without having to push
    into it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694467

 js/ui/layout.js |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index f8b91b7..ef4273d 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -1303,6 +1303,11 @@ const PressureBarrier = new Lang.Class({
         this._reset();
     },
 
+    _trigger: function() {
+        this.emit('trigger');
+        this._reset();
+    },
+
     _onBarrierHit: function(barrier, event) {
         // Throw out all events where the pointer was grabbed by another
         // client, as the client that grabbed the pointer expects to have
@@ -1320,6 +1325,11 @@ const PressureBarrier = new Lang.Class({
         let slide = this._getDistanceAlongBarrier(event);
         let distance = this._getDistanceAcrossBarrier(event);
 
+        if (distance >= this._threshold) {
+            this._trigger();
+            return;
+        }
+
         // Throw out events where the cursor is move more
         // along the axis of the barrier than moving with
         // the barrier.
@@ -1332,10 +1342,8 @@ const PressureBarrier = new Lang.Class({
         this._barrierEvents.push(event);
         this._currentPressure += Math.min(15, distance);
 
-        if (this._currentPressure >= this._threshold) {
-            this.emit('trigger');
-            this._reset();
-        }
+        if (this._currentPressure >= this._threshold)
+            this._trigger();
     }
 });
 Signals.addSignalMethods(PressureBarrier.prototype);


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