From 91cf255c5ad4eea8ad2022d8d9904f8b6419024a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 26 Mar 2018 15:48:24 +0200 Subject: Cocoa: Fix isChildNSWindow() for embedded QWindows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit e3d21ef0 removed the manual m_isNSWindowChild mode in favor of using m_view.window.parentWindow as a declarative test. However, this test has a false positive if the QWindow in question is a non-child QWindow which is embedded in a foreign NSView/NSWindow hierarchy. In the QTBUG-56589 case m_view.window.parentWindow is some internal window in the Photos app, which is not relevant to the Qt QWindow configuration. Improve the isChildWindow() test: the QWindow must actually be a child QWindow. Task-number: QTBUG-56589 Change-Id: I0e6e262c85f47267a6165e7f98e48264b1e00069 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index aeeef55598..86fd7b8a9f 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1608,7 +1608,7 @@ QCocoaGLContext *QCocoaWindow::currentContext() const */ bool QCocoaWindow::isChildNSWindow() const { - return m_view.window.parentWindow != nil; + return window()->parent() != nullptr && m_view.window.parentWindow != nil; } /*! -- cgit v1.2.3