From e622e069c9b0928e09a8b6fef15168407a4d995a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 22 Feb 2019 13:27:33 +0100 Subject: Update the cursor when the window is entered When a window is entered, due to another window being hidden, then it is possible that the item under the mouse has a different cursor than the one previously set for that window. Since there will not be a mouse move at this point yet, then we should update the cursor right away. Change-Id: I2ef3c72617ae5c995a4daf7daef1ba3311fdcc12 Fixes: QTBUG-41045 Reviewed-by: Mitch Curtis Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quick/items/qquickwindow.cpp') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 61c8bcc1e7..fa5d64d7be 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1614,6 +1614,7 @@ bool QQuickWindow::event(QEvent *e) bool delivered = d->deliverHoverEvent(d->contentItem, enter->windowPos(), d->lastMousePosition, QGuiApplication::keyboardModifiers(), 0L, accepted); enter->setAccepted(accepted); + d->updateCursor(mapFromGlobal(QCursor::pos())); return delivered; } break; -- cgit v1.2.3 From 042f2b67739439c020451843d887d131d5f9cbdc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 25 Feb 2019 13:57:46 +0100 Subject: Don't crash if the synth-mouse touchpoint is absent from a touch event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-74008 Change-Id: Ib232b723e4a246db0312145ef475ce81cd5f1a5f Reviewed-by: Jan Arve Sæther --- src/quick/items/qquickwindow.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/quick/items/qquickwindow.cpp') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index fa5d64d7be..518970d1b7 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2528,18 +2528,22 @@ bool QQuickWindowPrivate::deliverPressOrReleaseEvent(QQuickPointerEvent *event, int pointCount = event->pointCount(); QVector targetItems; bool isTouchEvent = (event->asPointerTouchEvent() != nullptr); - if (isTouchEvent && event->isPressEvent() && isDeliveringTouchAsMouse() && - pointerEventInstance(touchMouseDevice)->pointById(touchMouseId)->grabberPointerHandler()) { - // When a second point is pressed, if the first point's existing - // grabber was a pointer handler while a filtering parent is filtering - // the same first point _as mouse_: we're starting over with delivery, - // so we need to allow the second point to now be sent as a synth-mouse - // instead of the first one, so that filtering parents (maybe even the - // same one) can get a chance to see the second touchpoint as a - // synth-mouse and perhaps grab it. Ideally we would always do this - // when a new touchpoint is pressed, but this compromise fixes - // QTBUG-70998 and avoids breaking tst_FlickableInterop::touchDragSliderAndFlickable - cancelTouchMouseSynthesis(); + if (isTouchEvent && event->isPressEvent() && isDeliveringTouchAsMouse()) { + if (const QQuickEventPoint *point = pointerEventInstance(touchMouseDevice)->pointById(touchMouseId)) { + // When a second point is pressed, if the first point's existing + // grabber was a pointer handler while a filtering parent is filtering + // the same first point _as mouse_: we're starting over with delivery, + // so we need to allow the second point to now be sent as a synth-mouse + // instead of the first one, so that filtering parents (maybe even the + // same one) can get a chance to see the second touchpoint as a + // synth-mouse and perhaps grab it. Ideally we would always do this + // when a new touchpoint is pressed, but this compromise fixes + // QTBUG-70998 and avoids breaking tst_FlickableInterop::touchDragSliderAndFlickable + if (point->grabberPointerHandler()) + cancelTouchMouseSynthesis(); + } else { + qCWarning(DBG_TOUCH_TARGET) << "during delivery of touch press, synth-mouse ID" << touchMouseId << "is missing from" << event; + } } for (int i = 0; i < pointCount; ++i) { auto point = event->point(i); -- cgit v1.2.3 From 1c7213dbc00fa595aeaa98ad5631bac56782599e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Thu, 23 Aug 2018 14:00:01 +0200 Subject: Fix a bug where hover events were not sent if the mouse was never moved This happened if the "real mouse" was never moved, since moving the real mouse caused it to update the internal QQuickWindowPrivate::lastMousePosition. If the window never got any mouse events, it would therefore fail to generate proper hover events. However, if the window got exposed under a mouse cursor it would generate a hover enter event. We therefore update lastMousePosition when that happens also. Change-Id: I77d9b1bd779a813756c4056b015f2e81664b6d36 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quick/items/qquickwindow.cpp') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 518970d1b7..fa9aa88faa 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1613,6 +1613,7 @@ bool QQuickWindow::event(QEvent *e) bool accepted = enter->isAccepted(); bool delivered = d->deliverHoverEvent(d->contentItem, enter->windowPos(), d->lastMousePosition, QGuiApplication::keyboardModifiers(), 0L, accepted); + d->lastMousePosition = enter->windowPos(); enter->setAccepted(accepted); d->updateCursor(mapFromGlobal(QCursor::pos())); return delivered; -- cgit v1.2.3