NSScreen screens may be empty so add the main screen in that case
In some circumstances NSScreen screens can be empty yet there is still a valid main screen so we prevent any problems arising by ensuring we work with the main screen in that instance. Task-number: QTBUG-37876 Change-Id: I5827009a9894eb8c1d4f5addc6c6f59e1c50c3d0 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>bb10
parent
24ac9f518d
commit
f2111ff1d7
|
|
@ -316,11 +316,17 @@ QCocoaIntegration *QCocoaIntegration::instance()
|
|||
*/
|
||||
void QCocoaIntegration::updateScreens()
|
||||
{
|
||||
NSArray *screens = [NSScreen screens];
|
||||
NSArray *scrs = [NSScreen screens];
|
||||
NSMutableArray *screens = [NSMutableArray arrayWithArray:scrs];
|
||||
if ([screens count] == 0)
|
||||
if ([NSScreen mainScreen])
|
||||
[screens addObject:[NSScreen mainScreen]];
|
||||
if ([screens count] == 0)
|
||||
return;
|
||||
QSet<QCocoaScreen*> remainingScreens = QSet<QCocoaScreen*>::fromList(mScreens);
|
||||
QList<QPlatformScreen *> siblings;
|
||||
for (uint i = 0; i < [screens count]; i++) {
|
||||
NSScreen* scr = [[NSScreen screens] objectAtIndex: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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue