summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@theqtcompany.com>2015-09-10 11:16:38 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-01-22 13:16:59 +0000
commitdb2675d6fdb0d44fe1b040eda47f75e8bb35ce7a (patch)
treed55210d9a44c638dfe7443a3f46774ce79d1785d /src/plugins
parent7dceb227485e4ebd240b9820b599faa4d2a24e93 (diff)
Cocoa: Update QWindow::screen() on expose/show.
This is needed to correctly handle show on non-primary screens. Change-Id: I80b13372b3a92786987a66f0da385af6b4a6a863 Task-number: QTBUG-47950 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 3b5909a37e..00cb43c940 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1775,6 +1775,18 @@ 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.
+ NSUInteger screenIndex = [[NSScreen screens] indexOfObject:m_nsWindow.screen];
+ if (screenIndex != NSNotFound) {
+ QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenAtIndex(screenIndex);
+ if (cocoaScreen)
+ window()->setScreen(cocoaScreen->screen());
+ }
+
if (!m_isExposed) {
m_isExposed = true;
m_exposedGeometry = geometry();