[gnome-shell] grabHelper: consume the press/motion/release sequence if a press dismisses the grab



commit bbfa616f275cdd41c052682f79f8e997f160c99c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 22 12:50:54 2014 +0200

    grabHelper: consume the press/motion/release sequence if a press dismisses the grab
    
    The grab would previously just consume the button release, while propagating
    motion events, possibly down to clients in wayland. This would produce
    inconsistent streams there.
    
    On pointer events, the inconsistency would just be having clients receiving
    events with the button 1 set in the mask, with no implicit grab. When touch
    events are handled, this would be more hindering as the client would receive
    touch_motion events with no prior touch_down nor later touch_up, something
    never supposed to happen.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733633

 js/ui/grabHelper.js |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index ec53deb..c5f76c8 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -283,12 +283,14 @@ const GrabHelper = new Lang.Class({
             return Clutter.EVENT_STOP;
         }
 
+        let motion = type == Clutter.EventType.MOTION;
         let press = type == Clutter.EventType.BUTTON_PRESS;
         let release = type == Clutter.EventType.BUTTON_RELEASE;
         let button = press || release;
 
-        if (release && this._ignoreRelease) {
-            this._ignoreRelease = false;
+        if (this._ignoreUntilRelease && (motion || release)) {
+            if (release)
+                this._ignoreUntilRelease = false;
             return Clutter.EVENT_STOP;
         }
 
@@ -299,10 +301,11 @@ const GrabHelper = new Lang.Class({
             return Clutter.EVENT_PROPAGATE;
 
         if (button) {
-            // If we have a press event, ignore the next event,
-            // which should be a release event.
+            // If we have a press event, ignore the next
+            // motion/release events.
             if (press)
-                this._ignoreRelease = true;
+                this._ignoreUntilRelease = true;
+
             let i = this._actorInGrabStack(event.get_source()) + 1;
             this.ungrab({ actor: this._grabStack[i].actor, isUser: true });
             return Clutter.EVENT_STOP;


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