Commit fe8ce66b53fc26f7db13efee72c85218df367c65

Sam Lantinga 2020-02-11T10:35:14

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 945cae4..959d545 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/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);