Revert "QGuiApplication: don't send pointer events to windows other than the active popup"

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ø <tor.arne.vestbo@qt.io>
This commit is contained in:
Richard Moe Gustavsen 2024-09-06 14:45:03 +02:00 committed by Jani Heikkinen
parent 10680554db
commit 893dc6d772

View File

@ -2444,15 +2444,13 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
ev.setTimestamp(e->timestamp); ev.setTimestamp(e->timestamp);
if (activePopup && activePopup != window && (!popup_closed_on_press || type == QEvent::MouseButtonRelease)) { 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); auto *handlingPopup = window->d_func()->forwardToPopup(&ev, active_popup_on_press);
if (handlingPopup && ev.isBeginEvent()) if (handlingPopup) {
active_popup_on_press = handlingPopup; if (type == QEvent::MouseButtonPress)
// Regardless of whether the popup accepted the event or not, we return now so that we active_popup_on_press = handlingPopup;
// don't forward it to the window under the mouse instead. We're only supposed to return;
// 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 (doubleClick && (ev.type() == QEvent::MouseButtonPress)) { if (doubleClick && (ev.type() == QEvent::MouseButtonPress)) {
@ -2977,15 +2975,9 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
tabletEvent.setTimestamp(e->timestamp); tabletEvent.setTimestamp(e->timestamp);
if (activePopup && activePopup != window) { if (activePopup && activePopup != window) {
auto *handlingPopup = window->d_func()->forwardToPopup(&tabletEvent, active_popup_on_press); // If the popup handles the event, we're done.
if (handlingPopup && tabletEvent.isBeginEvent()) if (window->d_func()->forwardToPopup(&tabletEvent, active_popup_on_press))
active_popup_on_press = handlingPopup; return;
// 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;
} }
QGuiApplication::sendSpontaneousEvent(window, &tabletEvent); QGuiApplication::sendSpontaneousEvent(window, &tabletEvent);