summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-09-18 18:17:21 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-09-18 20:11:51 +0000
commit1a3863147d8b7680076c5268900d76f7503f1fb4 (patch)
tree73af7dd7022ab5f67620007a12e310176d8b035e
parentf1c1f444811643acda66aaeb21a9e73a8e60e830 (diff)
Emit CancelGrabExclusive when one grabber is replaced by another
Qt Quick Pointer Handlers depend on this behavior: QQuickPointerHandler::onGrabChanged() receives only the grabber that was losing the grab or the one that is receiving it, not both at the same time. UngrabExclusive means the original grabber simply relinquished the grab by setting the exclusive grabber to null. CancelGrabExclusive means the new grabber took over the grab that the old grabber had before. Task-number: QTBUG-86729 Change-Id: Iefca6fe91b11fcb03d2c6ac3598841c924facb22 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/gui/kernel/qpointingdevice.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp
index 779893861a..349fb55cbe 100644
--- a/src/gui/kernel/qpointingdevice.cpp
+++ b/src/gui/kernel/qpointingdevice.cpp
@@ -475,7 +475,8 @@ void QPointingDevicePrivate::setExclusiveGrabber(const QPointerEvent *event, con
auto oldGrabber = persistentPoint->exclusiveGrabber;
persistentPoint->exclusiveGrabber = exclusiveGrabber;
if (oldGrabber)
- emit q->grabChanged(oldGrabber, QPointingDevice::UngrabExclusive, event, persistentPoint->eventPoint);
+ emit q->grabChanged(oldGrabber, exclusiveGrabber ? QPointingDevice::CancelGrabExclusive : QPointingDevice::UngrabExclusive,
+ event, persistentPoint->eventPoint);
if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) {
qCDebug(lcPointerGrab) << name << "point" << point.id() << point.state()
<< "@" << point.scenePosition()