From 1bd0ab7050304d9e8989cde77e486947c56b9696 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 11 Apr 2016 16:49:41 +0200 Subject: deliver stationary touchpoints which have changed velocity When using TUIO, and the finger or token comes to a stop, the last event has a stationary touchpoint with zero velocity, but the previous event had movement, with non-zero velocity. If the UI is going to do something with the velocity values, it needs to know when that goes to zero. So this is an exception to the rule that we don't deliver stationary touchpoints. Task-number: QTBUG-52510 Change-Id: Iaa9f72a3749130f6806f2f63512a6ffddca06bce Reviewed-by: Robin Burchell --- src/gui/kernel/qguiapplication.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 9f566213bc..129e93db8d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2450,6 +2450,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To QWindow *window = e->window.data(); typedef QPair > StatesAndTouchPoints; QHash windowsNeedingEvents; + bool velocityOnly = false; for (int i = 0; i < e->points.count(); ++i) { QTouchEvent::TouchPoint touchPoint = e->points.at(i); @@ -2526,10 +2527,14 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // 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) - touchInfo.touchPoint.setVelocity(touchPoint.velocity()); - else + if (touchPoint.state() == Qt::TouchPointStationary) { + if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) { + touchInfo.touchPoint.setVelocity(touchPoint.velocity()); + velocityOnly = true; + } + } else { touchInfo.touchPoint = touchPoint; + } break; } @@ -2563,7 +2568,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To break; case Qt::TouchPointStationary: // don't send the event if nothing changed - continue; + if (velocityOnly) + eventType = QEvent::TouchUpdate; + else + continue; default: eventType = QEvent::TouchUpdate; break; -- cgit v1.2.3