From 09cad13e49a9b6e6be565854fa4404d604939c03 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Mon, 17 Oct 2011 14:45:45 +0200 Subject: [PATCH] Fix TouchPoint::lastPos() after TouchPointStationary only events. lastPos is copied from the last point's position, and the position has to be resolved according the the receiving item's transformation. However, if a QTouchEvent contains only stationary points, it won't be delivered, it's pos()/rect() will still be uninitialized, and the touch point of the next event will be delivered with the uninitialized pos() as it's lastPos(). This patch makes sure that the lastPos() won't be filled with a previous incomplete stationary point state even if the platform is sending us stationary-point-only touch events. Change-Id: Ia7d10423c8fbe78348edbb0a89fbfa66d1b8b5d1 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qguiapplication.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index e4216a60b9..a16685e7fa 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -850,7 +850,11 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); if (touchPoint.pressure() < qreal(0.)) touchPoint.d->pressure = qreal(1.); - d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; + + // Stationary points might not be delivered down to the receiving item + // and get their position transformed, keep the old values instead. + if (touchPoint.state() != Qt::TouchPointStationary) + d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; break; }