From 8ba5fe15623bb777cf7fa3768a4b87052d36ccde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Dec 2016 14:27:31 +0100 Subject: macOS: Don't update screen for child windows Results in 'Attempt to set a screen on a child window' warning from QWindow. Change-Id: Ib421bada07d2085c33a4dcb62e705b2c8e2ba1c4 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qcocoawindow.mm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index c8f890a11c..c2f0122243 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -2026,13 +2026,15 @@ void QCocoaWindow::exposeWindow() if (!isWindowExposable()) return; - // Update the QWindow's screen property. This property is set - // to QGuiApplication::primaryScreen() at QWindow construciton - // time, and we won't get a NSWindowDidChangeScreenNotification - // on show. The case where the window is initially displayed - // on a non-primary screen needs special handling here. - if (QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenForNSScreen(m_nsWindow.screen)) - window()->setScreen(cocoaScreen->screen()); + if (window()->isTopLevel()) { + // Update the QWindow's screen property. This property is set + // to QGuiApplication::primaryScreen() at QWindow construciton + // time, and we won't get a NSWindowDidChangeScreenNotification + // on show. The case where the window is initially displayed + // on a non-primary screen needs special handling here. + if (QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenForNSScreen(m_nsWindow.screen)) + window()->setScreen(cocoaScreen->screen()); + } if (!m_isExposed) { m_isExposed = true; -- cgit v1.2.3