Browse Source

Attempt to make version detection safe for Mac OS X < 10.10

Sam Lantinga 5 years ago
parent
commit
fe8ce66b53
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/video/cocoa/SDL_cocoawindow.m

+ 4 - 2
src/video/cocoa/SDL_cocoawindow.m

@@ -1796,8 +1796,10 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
         /* Hack to fix origin on Mac OS X 10.4
            This is no longer needed as of Mac OS X 10.15, according to bug 4822.
          */
-        NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
-        if ((version.majorVersion == 10) && (version.minorVersion < 15)) {
+        NSProcessInfo *processInfo = [NSProcessInfo processInfo];
+        NSOperatingSystemVersion version = { 10, 15, 0 };
+        if (![processInfo respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)] ||
+            ![processInfo isOperatingSystemAtLeastVersion:version]) {
             NSRect screenRect = [[nswindow screen] frame];
             if (screenRect.size.height >= 1.0f) {
                 rect.origin.y += (screenRect.size.height - rect.size.height);