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 <jake.petroules@qt.io>
This commit is contained in:
Tor Arne Vestbø 2016-12-12 14:27:31 +01:00
parent dd58804cfe
commit 8ba5fe1562

View File

@ -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;