From 893dc6d772f53d8ba44165397d79a2dbc762a6a7 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 6 Sep 2024 14:45:03 +0200 Subject: [PATCH] Revert "QGuiApplication: don't send pointer events to windows other than the active popup" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2e711e47e0fedd636af2116c56622cc7be958808. After closer investigation, it turns out that menus in Quick before 6.8 does infact forward pointer events outside the popup to the item under the mouse. Only if the popup is modal will this be blocked. So blocking this from QGuiApplication will cause a difference between Popup.Item and Popup.Window, and needs more investigation. Change-Id: I7d21258cb8fafd7380786fed0d6370e0a9090188 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c89b67b1c30..e0cee816454 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2444,15 +2444,13 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo ev.setTimestamp(e->timestamp); if (activePopup && activePopup != window && (!popup_closed_on_press || type == QEvent::MouseButtonRelease)) { + // If the popup handles the event, we're done. auto *handlingPopup = window->d_func()->forwardToPopup(&ev, active_popup_on_press); - if (handlingPopup && ev.isBeginEvent()) - active_popup_on_press = handlingPopup; - // Regardless of whether the popup accepted the event or not, we return now so that we - // don't forward it to the window under the mouse instead. We're only supposed to - // do such forwarding if QPlatformIntegration::ReplayMousePressOutsidePopup is set, - // but support for that is currently not reimplemented (it needs to be done in - // conjunction with support for WA_NoMouseReplay). This is normally only wanted on Windows. - return; + if (handlingPopup) { + if (type == QEvent::MouseButtonPress) + active_popup_on_press = handlingPopup; + return; + } } if (doubleClick && (ev.type() == QEvent::MouseButtonPress)) { @@ -2977,15 +2975,9 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T tabletEvent.setTimestamp(e->timestamp); if (activePopup && activePopup != window) { - auto *handlingPopup = window->d_func()->forwardToPopup(&tabletEvent, active_popup_on_press); - if (handlingPopup && tabletEvent.isBeginEvent()) - active_popup_on_press = handlingPopup; - // Regardless of whether the popup accepted the event or not, we return now so that we - // don't forward it to the window under the mouse instead. We're only supposed to - // do such forwarding if QPlatformIntegration::ReplayMousePressOutsidePopup is set, - // but support for that is currently not reimplemented (it needs to be done in - // conjunction with support for WA_NoMouseReplay). This is normally only wanted on Windows. - return; + // If the popup handles the event, we're done. + if (window->d_func()->forwardToPopup(&tabletEvent, active_popup_on_press)) + return; } QGuiApplication::sendSpontaneousEvent(window, &tabletEvent);