SDL: Fixed building with the macOS 10.8 SDK

From cc094f4d7c6c0c338f3add9167e7d22373d43c96 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 14 Nov 2021 20:15:48 -0800
Subject: [PATCH] Fixed building with the macOS 10.8 SDK

---
 src/video/cocoa/SDL_cocoawindow.m | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index af9e3dbdbb..eed00c9aba 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -55,12 +55,19 @@
 #ifndef MAC_OS_X_VERSION_10_12
 #define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
 #endif
+#ifndef NSAppKitVersionNumber10_13_2
+#define NSAppKitVersionNumber10_13_2    1561.2
+#endif
 #ifndef NSAppKitVersionNumber10_14
-#define NSAppKitVersionNumber10_14 1671
+#define NSAppKitVersionNumber10_14      1671
 #endif
 
-/* This is available as of 10.13.2, but isn't in public headers */
 @interface NSWindow (SDL)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 /* Added in the 10.10 SDK */
+@property (readonly) NSRect contentLayoutRect;
+#endif
+
+/* This is available as of 10.13.2, but isn't in public headers */
 @property (nonatomic) NSRect mouseConfinementRect;
 @end
 
@@ -391,7 +398,7 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
 {
     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
 
-    if (@available(macOS 10.13.2, *)) {
+    if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_13_2) {
         NSWindow *nswindow = data->nswindow;
         SDL_Rect mouse_rect;
 
@@ -1280,7 +1287,7 @@ - (void)mouseMoved:(NSEvent *)theEvent
     x = (int)point.x;
     y = (int)(window->h - point.y);
 
-    if (@available(macOS 10.13.2, *)) {
+    if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_13_2) {
         /* Mouse grab is taken care of by the confinement rect */
     } else {
         CGPoint cgpoint;