diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-12-07 16:48:31 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-12-08 03:27:06 +0100 |
commit | ae3594436b9b0540ef94379a73bf8fec8d3b7465 (patch) | |
tree | 3d76517f4e396c40c2581c4d1914f6f0e5a43f21 /src/plugins/platforms/cocoa/qnswindow.mm | |
parent | 017e41bb8671ed273fffcd2899c3e963d4dd9445 (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
Pick-to: 6.0
Pick-to: 5.15
Change-Id: I005a402b21e8dc16c3b18bcd7e67d12b94a66f44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnswindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindow.mm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index e7c7f6dc5d..d9158bbcae 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -180,6 +180,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)]) |