Attempt to make version detection safe for Mac OS X < 10.10
authorSam Lantinga <slouken@libsdl.org>
Tue, 11 Feb 2020 10:35:14 -0800
changeset 13508a6d3d330dedc
parent 13507 25c5f567de44
child 13509 4439a13420fb
Attempt to make version detection safe for Mac OS X < 10.10
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Tue Feb 11 10:21:31 2020 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Tue Feb 11 10:35:14 2020 -0800
     1.3 @@ -1796,8 +1796,10 @@
     1.4          /* Hack to fix origin on Mac OS X 10.4
     1.5             This is no longer needed as of Mac OS X 10.15, according to bug 4822.
     1.6           */
     1.7 -        NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
     1.8 -        if ((version.majorVersion == 10) && (version.minorVersion < 15)) {
     1.9 +        NSProcessInfo *processInfo = [NSProcessInfo processInfo];
    1.10 +        NSOperatingSystemVersion version = { 10, 15, 0 };
    1.11 +        if (![processInfo respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)] ||
    1.12 +            ![processInfo isOperatingSystemAtLeastVersion:version]) {
    1.13              NSRect screenRect = [[nswindow screen] frame];
    1.14              if (screenRect.size.height >= 1.0f) {
    1.15                  rect.origin.y += (screenRect.size.height - rect.size.height);