summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-03-06 13:59:42 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-28 15:31:38 +0000
commitcc0064bfe6933743acdf6f7f9327da526c745c2d (patch)
tree15330f5ca1d8513a519028b31184d675b21c637d /src
parent791153d573ea1bac3a388a12146d43c785761dbe (diff)
downloadqtbase-cc0064bfe6933743acdf6f7f9327da526c745c2d.tar.gz
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. Change-Id: I88aa796c679be0489abf4999829d1378ba054bdc Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit b64b0c7947f9f2b0ab4ed33fe526880f54e3981f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index a88032557b..0e9c134f54 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();