From b850322147250a1bd35d5c63e958dec161284244 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 16 Sep 2020 16:37:25 +0200 Subject: QPointingDevPriv::setExclusiveGrabber: emit grabChanged with point found ...not with the given point. Since QEventPoint has a constructor that takes an id, it's possible to write something like pointerEvent->setExclusiveGrabber(pointId, object) which will construct a QEventPoint on-the-fly, containing only an id. (That was unintentional, but perhaps useful sometimes.) setExclusiveGrabber() looks up the persistent point, but if we emit the signal with the given point, it is missing the device. A handler connected to that signal might reasonably assume that the point is a complete instance; so we'd better emit the complete instance that we found. (OTOH if the given point was a detached instance, it might also be unexpected that the signal emits the persistent instance instead of the given instance.) Amends 2692237bb1b0c0f50b7cc5d920eb8ab065063d47 Change-Id: Iee16363dcb22c1dc07b0cc0a81930218e22fa19e Reviewed-by: Volker Hilsheimer --- src/gui/kernel/qpointingdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp index 227c4ef2cc..779893861a 100644 --- a/src/gui/kernel/qpointingdevice.cpp +++ b/src/gui/kernel/qpointingdevice.cpp @@ -475,7 +475,7 @@ void QPointingDevicePrivate::setExclusiveGrabber(const QPointerEvent *event, con auto oldGrabber = persistentPoint->exclusiveGrabber; persistentPoint->exclusiveGrabber = exclusiveGrabber; if (oldGrabber) - emit q->grabChanged(oldGrabber, QPointingDevice::UngrabExclusive, event, point); + emit q->grabChanged(oldGrabber, QPointingDevice::UngrabExclusive, event, persistentPoint->eventPoint); if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled())) { qCDebug(lcPointerGrab) << name << "point" << point.id() << point.state() << "@" << point.scenePosition() -- cgit v1.2.3