summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-12-07 16:48:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-08 04:39:34 +0000
commit0b0e43bc408921295cce0dd12d6943c19eadad4c (patch)
tree9775564aee58be4b9d7b9c07ad704b96ad17d902
parentc73b8e31d01865ef664386c668b243acd100220e (diff)
macOS: Always allow interacting with popup windows during modal session
f4889e63c7b changed the worksWhenModal logic for QNSWindow to be based on the transient parent relationship of the child window to the modal session window, to fix many issues where windows that should be blocked were not. Unfortunately, some window types do not maintain a transient parent relationship (e.g. QCompleter, which is itself just a QObject), or are not common for users to create with a QWidget parent (such as a context QMenu). This change restores part of the special-casing that was removed in f4889e, so that all popup windows are always allowed to be interacted with during modal sessions. This includes popup windows that were opened as part of a parent modal session, which would normally be fully blocked, but we assume that popup windows are intermittent enough that this will not be a problem. For now we leave out the other two special casings from f4889e, namely tool windows and dialogs. The former should in most cases be created with a parent window, while the latter definitely should. Fixes: QTBUG-88188 Fixes: QTBUG-88985 Fixes: QTBUG-87849 Fixes: QTBUG-86845 Change-Id: I005a402b21e8dc16c3b18bcd7e67d12b94a66f44 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit ae3594436b9b0540ef94379a73bf8fec8d3b7465) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm
index 1756d429ea..8967636fd2 100644
--- a/src/plugins/platforms/cocoa/qnswindow.mm
+++ b/src/plugins/platforms/cocoa/qnswindow.mm
@@ -178,6 +178,14 @@ static bool isMouseEvent(NSEvent *ev)
if (!NSApp.modalWindow)
return NO;
+ // Special case popup windows (menus, completions, etc), as these usually
+ // don't have a transient parent set, and we don't want to block them. The
+ // assumption is that these windows are only opened intermittently, from
+ // within windows that can already be interacted with in this modal session.
+ Qt::WindowType type = m_platformWindow->window()->type();
+ if (type == Qt::Popup)
+ return YES;
+
// If the current modal window (top level modal session) is not a Qt window we
// have no way of knowing if this window is transient child of the modal window.
if (![NSApp.modalWindow conformsToProtocol:@protocol(QNSWindowProtocol)])