diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-29 21:49:57 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-06-08 15:27:13 +0000 |
commit | 73094e598f26720838f0698303429e26915ecf6d (patch) | |
tree | 4d63b1b8e9fce7b994c13ce29970f2a2c72bb318 /src/quick | |
parent | b7ea85417ffff4df0b9538c010e07238db24ab28 (diff) |
DeliveryAgent: don't cancelTouchMouseSynthesis() prematurely
Do cancelTouchMouseSynthesis() when all touchpoints are released, or
when the touchmouse is released; but not because another point is
released while the touchmouse is still held.
Fixes: QTBUG-102996
Fixes: QTBUG-103766
Change-Id: I1de21c1119ab1c420f41af32580b25691d28f14e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 68bfa46f6c712fce0b00a7bbe6fa22e4f42079b9)
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/util/qquickdeliveryagent.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp index dc2d15cdbf..afde30f9e7 100644 --- a/src/quick/util/qquickdeliveryagent.cpp +++ b/src/quick/util/qquickdeliveryagent.cpp @@ -1754,9 +1754,17 @@ void QQuickDeliveryAgentPrivate::deliverPointerEvent(QPointerEvent *event) if (event->isEndEvent()) deliverPressOrReleaseEvent(event, true); - // failsafe: never allow touch->mouse synthesis to persist after release - if (event->isEndEvent() && isTouchEvent(event)) - cancelTouchMouseSynthesis(); + // failsafe: never allow touch->mouse synthesis to persist after all touchpoints are released, + // or after the touchmouse is released + if (isTouchEvent(event) && touchMouseId >= 0) { + if (static_cast<QTouchEvent *>(event)->touchPointStates() == QEventPoint::State::Released) { + cancelTouchMouseSynthesis(); + } else { + auto touchMousePoint = event->pointById(touchMouseId); + if (touchMousePoint && touchMousePoint->state() == QEventPoint::State::Released) + cancelTouchMouseSynthesis(); + } + } eventsInDelivery.pop(); if (sceneTransform) { |