From 0012f8bd152a36a67abc696465f27d612625b5d9 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Sat, 26 Oct 2019 22:31:45 +0200 Subject: MultiPointTouchArea: stop ignoring Qt-synthesized mouse events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We ignored them because we assume that if a touch event is sent first, the MultiPointTouchArea will handle it; and then if a synth-mouse event is sent afterwards for some reason, it's irrelevant to MPTA. However: 1) A synth-mouse event should not actually be sent, because MPTA accepts the touch event. 2) If Flickable is used with pressDelay set, Flickable will send the delayed press in the form of a mouse event (it does not know how to replay a touch event at all). So if MPTA is used in a ListView delegate for example, it's necessary for MPTA to react to a synth-mouse event during replay. In both the press delay replay and QTabletEvent scenarios, the mouse event has source() set to MouseEventSynthesizedByQt, so MPTA needs to handle those events. After a synth-mouse event during replay, MPTA can still receive an actual touch release, which thoroughly confuses its pre-existing logic. In that case it helps to check whether the touchpoint ID is the same as QQuickWindowPrivate::touchMouseId, handle the release of that point, and also release the internal synthetic _mouseQpaTouchPoint which was remembered from the mouse press. Fixes: QTBUG-75750 Fixes: QTBUG-78818 Change-Id: I8149f8b05f00677eb07a2f09b725b1db5f95b122 Reviewed-by: Jan Arve Sæther --- src/quick/items/qquickmultipointtoucharea_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/quick/items/qquickmultipointtoucharea_p.h') diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 634ea1c2e2..23f4ebff75 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -284,7 +284,7 @@ protected: #endif private: - void ungrab(); + void ungrab(bool normalRelease = false); QMap _touchPrototypes; //TouchPoints defined in QML QMap _touchPoints; //All current touch points QList _releasedTouchPoints; @@ -292,8 +292,10 @@ private: QList _movedTouchPoints; int _minimumTouchPoints; int _maximumTouchPoints; + QVector _lastFilterableTouchPointIds; QPointer _mouseTouchPoint; // exists when mouse button is down and _mouseEnabled is true; null otherwise QTouchEvent::TouchPoint _mouseQpaTouchPoint; // synthetic QPA touch point to hold state and position of the mouse + const QTouchDevice *_touchMouseDevice; QPointF _mousePos; bool _stealMouse; bool _mouseEnabled; -- cgit v1.2.3