SDL: SDL_cocoamodes.m (Cocoa_GetDisplayDPI): fix build using older toolchains

From 4b112620a3778f2a5437d73e6d7bf1d2b76002ae Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 2 Jan 2022 19:11:50 +0300
Subject: [PATCH] SDL_cocoamodes.m (Cocoa_GetDisplayDPI): fix build using older
 toolchains

Fixes https://github.com/libsdl-org/SDL/issues/5162
---
 src/video/cocoa/SDL_cocoamodes.m | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 5ed1f41bed6..2ec446b58e0 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -461,9 +461,9 @@
     for (NSScreen *screen in screens) {
         const CGDirectDisplayID dpyid = (const CGDirectDisplayID ) [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue];
         if (dpyid == data->display) {
-        
+#ifdef MAC_OS_X_VERSION_10_8
             /* Neither CGDisplayScreenSize(description's NSScreenNumber) nor [NSScreen backingScaleFactor] can calculate the correct dpi in macOS. E.g. backingScaleFactor is always 2 in all display modes for rMBP 16" */
-            if (@available(macOS 10.8, *)) {
+            if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_7) {
                 CFStringRef dmKeys[1] = { kCGDisplayShowDuplicateLowResolutionModes };
                 CFBooleanRef dmValues[1] = { kCFBooleanTrue };
                 CFDictionaryRef dmOptions = CFDictionaryCreate(kCFAllocatorDefault, (const void**) dmKeys, (const void**) dmValues, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
@@ -492,14 +492,15 @@
                 }
                 CFRelease(allDisplayModes);
                 CFRelease(dmOptions);
-            } else if (@available(macOS 10.7, *)) {
+            } else
+#endif
+            if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
                 // fallback for 10.7
                 scaleFactor = [screen backingScaleFactor];
                 displayNativeSize.width = displayNativeSize.width * scaleFactor;
                 displayNativeSize.height = displayNativeSize.height * scaleFactor;
                 break;
             }
-            
         }
     }