From 1775bbc6d4231fd10ccfcea006d78d8769b854a2 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 2 Jul 2021 19:49:45 +0200 Subject: QQDeliveryAgent: keep lastMousePosition updated during dragging Given that we store lastMousePosition (which I hope we can move to QPointingDevice eventually), the idea is it should always be correct; so don't bypass updating it during a mouse move just because there's a grabber. It resulted in synthetic hover events being sent after release, with an outdated last-known mouse position. Fixes: QTBUG-92563 Change-Id: Ic708bfcbdfcd0a9f6dc2cfd42f0671b0661e76bb Reviewed-by: Fabian Kosmale (cherry picked from commit 930da44767dcd0ccb50aaf725e3cbac99eaf13ea) --- src/quick/util/qquickdeliveryagent.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp index 72b532d0a4..098e215829 100644 --- a/src/quick/util/qquickdeliveryagent.cpp +++ b/src/quick/util/qquickdeliveryagent.cpp @@ -1366,10 +1366,10 @@ void QQuickDeliveryAgentPrivate::handleMouseEvent(QMouseEvent *event) #if QT_CONFIG(cursor) QQuickWindowPrivate::get(rootItem->window())->updateCursor(event->scenePosition()); #endif + const QPointF last = lastMousePosition.isNull() ? event->scenePosition() : lastMousePosition; + lastMousePosition = event->scenePosition(); + qCDebug(lcHoverTrace) << q << "mouse pos" << last << "->" << lastMousePosition; if (!event->points().count() || !event->exclusiveGrabber(event->point(0))) { - QPointF last = lastMousePosition.isNull() ? event->scenePosition() : lastMousePosition; - lastMousePosition = event->scenePosition(); - qCDebug(lcHoverTrace) << q << "mouse pos" << last << "->" << lastMousePosition << event; bool accepted = event->isAccepted(); bool delivered = deliverHoverEvent(rootItem, event->scenePosition(), last, event->modifiers(), event->timestamp(), accepted); if (!delivered) { @@ -1413,7 +1413,7 @@ void QQuickDeliveryAgentPrivate::flushFrameSynchronousEvents(QQuickWindow *win) if (frameSynchronousHoverEnabled && !win->mouseGrabberItem() && !lastMousePosition.isNull() && QQuickWindowPrivate::get(win)->dirtyItemList) { bool accepted = false; - qCDebug(lcHoverTrace) << q << "delivering frame-sync hover to root"; + qCDebug(lcHoverTrace) << q << "delivering frame-sync hover to root @" << lastMousePosition; bool delivered = deliverHoverEvent(rootItem, lastMousePosition, lastMousePosition, QGuiApplication::keyboardModifiers(), 0, accepted); if (!delivered) clearHover(); // take care of any exits -- cgit v1.2.3