summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-04-11 16:49:41 +0200
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-04-12 12:37:14 +0000
commit1bd0ab7050304d9e8989cde77e486947c56b9696 (patch)
tree13cc5d08de35d777397693ce14273a2d50d76130 /src
parent9f3dc2b282fc3674613759f3d890e4657d3834f2 (diff)
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 <robin.burchell@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qguiapplication.cpp16
1 files changed, 12 insertions, 4 deletions
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<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
QHash<QWindow *, StatesAndTouchPoints> 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;