[gnome-shell] layout: Debounce triggering barriers



commit 0cc161525254b367fae5e1abc466e90414d938e8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Mar 1 15:29:42 2013 -0500

    layout: Debounce triggering barriers
    
    Ensure that the pointer leaves the barrier before we trigger again.
    
    For the message tray case, this doesn't matter much, as the trigger
    won't have any effect after the grab is taken, but in the overview
    HotCorner case, this ensures that we don't trigger the overview
    transition many times simply by holding pressure against the hot
    corner, which is easy to do accidentally.

 js/ui/layout.js |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index bcc0dda..e2691c0 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -1264,6 +1264,7 @@ const PressureBarrier = new Lang.Class({
         this._timeout = timeout;
         this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : 
Clutter.Orientation.VERTICAL;
 
+        this._isTriggered = false;
         this._reset();
 
         this._barrierHitId = this._barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
@@ -1322,14 +1323,21 @@ const PressureBarrier = new Lang.Class({
 
     _onBarrierLeft: function(barrier, event) {
         this._reset();
+        this._isTriggered = false;
     },
 
     _trigger: function() {
+        this._isTriggered = true;
         this.emit('trigger');
         this._reset();
     },
 
     _onBarrierHit: function(barrier, event) {
+        // If we've triggered the barrier, wait until the pointer has the
+        // left the barrier hitbox until we trigger it again.
+        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


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