Fix cocoa plugin build with OS X 10.8 SDK
With the 10.8 SDK, NSArray may not respond to firstObject which ends the build with an error. This implementation doesn't use it and also handles the case where no screen is available when calling qt_mac_mainScreenHeight Change-Id: Idce278423c37cc24d8fc31062a386e78d6487492 Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
This commit is contained in:
parent
27361eadf1
commit
f7e9e035fd
@ -634,10 +634,14 @@ QString qt_mac_applicationName()
|
||||
int qt_mac_mainScreenHeight()
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
// The first screen in the screens array is documented
|
||||
// to have the (0,0) origin.
|
||||
NSRect screenFrame = [[[NSScreen screens] firstObject] frame];
|
||||
return screenFrame.size.height;
|
||||
NSArray *screens = [NSScreen screens];
|
||||
if ([screens count] > 0) {
|
||||
// The first screen in the screens array is documented
|
||||
// to have the (0,0) origin.
|
||||
NSRect screenFrame = [[screens objectAtIndex: 0] frame];
|
||||
return screenFrame.size.height;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qt_mac_flipYCoordinate(int y)
|
||||
|
Loading…
Reference in New Issue
Block a user