diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-10 15:23:47 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-07-11 11:36:15 +0000 |
commit | 072119918762448391414d570e029fd1b53ff3de (patch) | |
tree | 7f83f120f45d9dd2ec685a9994d05f47162f3555 /src/plugins | |
parent | e7ba24bd70d4c776b7e5cd9691bdb3b81acf94bc (diff) |
macOS: Deliver screen change on window creation instead of on first expose
We know the resulting screen based on the geometry mappings we now do, so
no need to wait until expose to deliver the screen change.
Change-Id: Ibb84948ab091d8f74d31cdd2d300b381e2e1e7cc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4f2a27c2c3..72ae27cab7 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1268,6 +1268,11 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class]; QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:frame screen:cocoaScreen->nativeScreen() styleMask:windowStyleMask(flags) qPlatformWindow:this]; + Q_ASSERT_X(nsWindow.screen == cocoaScreen->nativeScreen(), "QCocoaWindow", + "Resulting NSScreen should match the requested NSScreen"); + + if (targetScreen != window()->screen()) + QWindowSystemInterface::handleWindowScreenChanged(window(), targetScreen); nsWindow.restorable = NO; nsWindow.level = windowLevel(flags); @@ -1655,16 +1660,6 @@ void QCocoaWindow::exposeWindow() if (!isWindowExposable()) return; - 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_view.window.screen)) - window()->setScreen(cocoaScreen->screen()); - } - if (!m_isExposed) { m_isExposed = true; m_exposedGeometry = geometry(); |