aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindow.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2015-03-13 15:13:22 +0100
committerShawn Rutledge <shawn.rutledge@digia.com>2015-03-20 15:14:41 +0000
commita86302d34f473811608f49643e54975425493628 (patch)
treea19eb0ac1f10af439b5bb8ebbaba397dc3433713 /src/quick/items/qquickwindow.cpp
parent5a349ff9b6575411f0b15a6b8b8affc10b881172 (diff)
QQuickWindow touch event compression: retain previous positions
The previous positions in the delayed touch event should be from the first touchpoint which is being delayed, not updated based on subsequent updates that are being merged into it. Clarified naming and comments in this section. Task-number: QTBUG-40167 Change-Id: Ie419267e4a33277f9154bd80f5bce104e52d773e Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r--src/quick/items/qquickwindow.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 35f4a84980..696f8f9080 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1868,19 +1868,23 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
Qt::TouchPointStates states;
for (int i = 0; i < event->touchPoints().count(); ++i) {
const QTouchEvent::TouchPoint &tp = tpts.at(i);
- const QTouchEvent::TouchPoint &tp2 = delayedTouch->touchPoints().at(i);
- if (tp.id() != tp2.id()) {
+ const QTouchEvent::TouchPoint &tpDelayed = delayedTouch->touchPoints().at(i);
+ if (tp.id() != tpDelayed.id()) {
mismatch = true;
break;
}
- if (tp2.state() == Qt::TouchPointMoved && tp.state() == Qt::TouchPointStationary)
+ if (tpDelayed.state() == Qt::TouchPointMoved && tp.state() == Qt::TouchPointStationary)
tpts[i].setState(Qt::TouchPointMoved);
+ tpts[i].setLastPos(tpDelayed.lastPos());
+ tpts[i].setLastScenePos(tpDelayed.lastScenePos());
+ tpts[i].setLastScreenPos(tpDelayed.lastScreenPos());
+ tpts[i].setLastNormalizedPos(tpDelayed.lastNormalizedPos());
states |= tpts.at(i).state();
}
- // same touch event? then merge if so
+ // matching touch event? then merge the new event into the old one
if (!mismatch) {
delayedTouch->setTouchPoints(tpts);
delayedTouch->setTimestamp(event->timestamp());
@@ -1888,8 +1892,7 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
}
}
- // otherwise; we need to deliver the delayed event first, and
- // then delay this one..
+ // merging wasn't possible, so deliver the delayed event first, and then delay this one
reallyDeliverTouchEvent(delayedTouch);
delete delayedTouch;
delayedTouch = new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints());