diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 4be49ed68f..e0838cb342 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -137,10 +137,9 @@ void QCocoaScreen::updateGeometry() m_name = QString::fromUtf8([[localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]] UTF8String]); [deviceInfo release]; - QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry()); + QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry()); QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), m_logicalDpi.first, m_logicalDpi.second); QWindowSystemInterface::handleScreenRefreshRateChange(screen(), m_refreshRate); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), availableGeometry()); } qreal QCocoaScreen::devicePixelRatio() const @@ -370,11 +369,15 @@ void QCocoaIntegration::updateScreens() return; QSet<QCocoaScreen*> remainingScreens = QSet<QCocoaScreen*>::fromList(mScreens); QList<QPlatformScreen *> siblings; - for (uint i = 0; i < [screens count]; i++) { + uint screenCount = [screens count]; + for (uint i = 0; i < screenCount; i++) { NSScreen* scr = [screens objectAtIndex:i]; CGDirectDisplayID dpy = [[[scr deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]; // If this screen is a mirror and is not the primary one of the mirror set, ignore it. - if (CGDisplayIsInMirrorSet(dpy)) { + // Exception: The NSScreen API has been observed to a return a screen list with one + // mirrored, non-primary screen when Qt is running as a startup item. Always use the + // screen if there's only one screen in the list. + if (screenCount > 1 && CGDisplayIsInMirrorSet(dpy)) { CGDirectDisplayID primary = CGDisplayMirrorsDisplay(dpy); if (primary != kCGNullDirectDisplay && primary != dpy) continue; |