From dcc7367997e7241918cdf0c702c7bb8325eb1ad4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 20 Apr 2017 09:59:00 +0200 Subject: TapHandler: do not react to stationary touchpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In autotests, stationary points normally have invalid position. A TapHandler does not need to react to them anyway. But we must also avoid having a grab cancelation due to a stationary point, and that applies to all PointerHandlers in general. Change-Id: I99493ad7d859e0c4ef155afc699aa34f28ffdbc7 Reviewed-by: Jan Arve Sæther --- src/quick/handlers/qquicktaphandler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/quick/handlers/qquicktaphandler.cpp') diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index aeda9a0357..14aeb07864 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -120,7 +120,7 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) case QQuickEventPoint::Released: ret = parentContains(point); break; - default: // update or stationary + case QQuickEventPoint::Updated: switch (m_gesturePolicy) { case DragThreshold: ret = !dragOverThreshold(point); @@ -133,12 +133,18 @@ bool QQuickTapHandler::wantsEventPoint(QQuickEventPoint *point) break; } break; + case QQuickEventPoint::Stationary: + // Never react in any way when the point hasn't moved. + // In autotests, the point's position may not even be correct, because + // QTest::touchEvent(window, touchDevice).stationary(1) + // provides no opportunity to give a position, so it ends up being random. + break; } // If this is the grabber, returning false from this function will cancel the grab, // so onGrabChanged(this, CancelGrabExclusive, point) and setPressed(false) will be called. // But when m_gesturePolicy is DragThreshold, we don't get an exclusive grab, but // we still don't want to be pressed anymore. - if (!ret && point->pointId() == pointId()) + if (!ret && point->pointId() == pointId() && point->state() != QQuickEventPoint::Stationary) setPressed(false, true, point); return ret; } -- cgit v1.2.3