From fb70893dd5e616356260fe0b391dd77007c7bfc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 13 Mar 2023 13:33:58 +0100 Subject: 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 --- src/gui/kernel/qguiapplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index dcb7191678..589a054c19 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2706,6 +2706,7 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl 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 // originate from a call to QWindow::close. + e->eventAccepted = false; return; } -- cgit v1.2.3