From 42b54aaa2170312d97730d84393866657a783706 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 24 Jul 2014 18:31:51 +0200 Subject: [PATCH] grabHelper: handle touch events during grab modality The "pointer emulating" touch sequence will be handled in order to dismiss the grab, while the others are just propagated. https://bugzilla.gnome.org/show_bug.cgi?id=733633 --- js/ui/grabHelper.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index c5f76c8cf..4474e4921 100644 --- a/js/ui/grabHelper.js +++ b/js/ui/grabHelper.js @@ -288,8 +288,16 @@ const GrabHelper = new Lang.Class({ let release = type == Clutter.EventType.BUTTON_RELEASE; let button = press || release; - if (this._ignoreUntilRelease && (motion || release)) { - if (release) + let touchUpdate = type == Clutter.EventType.TOUCH_UPDATE; + let touchBegin = type == Clutter.EventType.TOUCH_BEGIN; + let touchEnd = type == Clutter.EventType.TOUCH_END; + let touch = touchUpdate || touchBegin || touchEnd; + + if (touch && !global.display.is_pointer_emulating_sequence (event.get_event_sequence())) + return Clutter.EVENT_PROPAGATE; + + if (this._ignoreUntilRelease && (motion || release || touch)) { + if (release || touchEnd) this._ignoreUntilRelease = false; return Clutter.EVENT_STOP; } @@ -300,10 +308,10 @@ const GrabHelper = new Lang.Class({ if (Main.keyboard.shouldTakeEvent(event)) return Clutter.EVENT_PROPAGATE; - if (button) { + if (button || touchBegin) { // If we have a press event, ignore the next // motion/release events. - if (press) + if (press || touchBegin) this._ignoreUntilRelease = true; let i = this._actorInGrabStack(event.get_source()) + 1;