diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-06 13:59:42 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-28 16:31:17 +0100 |
commit | b64b0c7947f9f2b0ab4ed33fe526880f54e3981f (patch) | |
tree | 45eb3ac560a749a26ec26da26056764bd10789f7 /src/plugins/platforms/cocoa | |
parent | aab71c7bb8e47b6e432fa7945bdf19fbce31a2f7 (diff) |
macOS: Don't try to create or manage NSWindow of foreign windows
A foreign window is a single NSView, and unlike our QNSView, where we
in addition manage a NSWindow for top level windows we should treat
the foreign window as just an NSView. It's not our place to neither
create nor dispose of any NSWindows attached to the foreign window.
Pick-to: 6.5
Change-Id: I88aa796c679be0489abf4999829d1378ba054bdc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 9ef7e5f4fc..5976722c91 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1435,6 +1435,14 @@ void QCocoaWindow::recreateWindowIfNeeded() { QMacAutoReleasePool pool; + if (isForeignWindow()) { + // A foreign window is created as such, and can never move between being + // foreign and not, so we don't need to get rid of any existing NSWindows, + // nor create new ones, as a foreign window is a single simple NSView. + qCDebug(lcQpaWindow) << "Skipping NSWindow management for foreign window" << this; + return; + } + QPlatformWindow *parentWindow = QPlatformWindow::parent(); const bool isEmbeddedView = isEmbedded(); |