aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickmultipointtoucharea.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-09-30 14:47:31 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2016-10-04 09:01:05 +0000
commitc6d66f2e88b42079df9c21c10cf8922871932a32 (patch)
tree573581023530ea3c76c4d0575dc36d8c8ba3f36d /src/quick/items/qquickmultipointtoucharea.cpp
parent33407ae00d7500255cd38b3c02a33a3f7359e9e2 (diff)
Fix mouse and touch grabbing issues
We keep track of the touch device and point ID, but didn't use them when queried for the mouse grabber. When setting the grabber, also take touch into account. Qt Location's touch/mouse handling, when it called the grab functions was not working correctly, because in QQuickWindow, we'd check for the old grabber and due to not checking the device/id, we'd get the wrong item, which would then result in the ungrab function not being called. When some item steals the grab for a touch point that was previously accepted as a synthetic mouse point, there was a high chance we would fail to deliver a mouse ungrab event. Make sure to ungrab the mouse as soon as we find any point with the corresponding ID. In addition, the multi point touch area tried to grab ids which were invalid (-1), avoid that. Task-number: QTBUG-55229 Task-number: QTBUG-56213 Change-Id: I73e4587bf4f94a65d88c5b60d93bc07743512e56 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickmultipointtoucharea.cpp')
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 504e63174a..706980cd13 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -470,8 +470,10 @@ void QQuickMultiPointTouchArea::grabGesture()
QVector<int> ids;
ids.reserve(_touchPoints.size());
- for (auto it = _touchPoints.keyBegin(), end = _touchPoints.keyEnd(); it != end; ++it)
- ids.append(*it);
+ for (auto it = _touchPoints.keyBegin(), end = _touchPoints.keyEnd(); it != end; ++it) {
+ if (*it != -1) // -1 might be the mouse-point, but we already grabbed the mouse above.
+ ids.append(*it);
+ }
grabTouchPoints(ids);
setKeepTouchGrab(true);
}