Don't accept QWSI::CloseEvent when the window is blocked by a modal window

If a window is blocked by another modal window, and we decide that as
a result we should not propagate the close event, we need to also
report this back to the platform plugin, so that it can tell the
operating system to not close the window.

This is a problem on macOS, where the system doesn't natively support
transient parents being blocked by a window-modal window, so the OS
will still allow interaction with the title bar close button, resulting
in a QWSI close event being delivered.

Fixes: QTBUG-104905
Pick-to: 6.5 6.2
Change-Id: I09ff15b0fbb1002a8f9d83d932ca766ed510f0a0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-03-13 13:33:58 +01:00
parent 826b606a5d
commit fb70893dd5

View File

@ -2706,6 +2706,7 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
if (e->window.data()->d_func()->blockedByModalWindow && !e->window.data()->d_func()->inClose) { if (e->window.data()->d_func()->blockedByModalWindow && !e->window.data()->d_func()->inClose) {
// a modal window is blocking this window, don't allow close events through, unless they // a modal window is blocking this window, don't allow close events through, unless they
// originate from a call to QWindow::close. // originate from a call to QWindow::close.
e->eventAccepted = false;
return; return;
} }