SDL: More changes to fix building with older macOS SDKs

From f4c12601206dda36f2996a95083e3e0602a9ca42 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 10 Mar 2023 16:38:45 -0800
Subject: [PATCH] More changes to fix building with older macOS SDKs

---
 src/video/cocoa/SDL_cocoaevents.m |  5 ++---
 src/video/cocoa/SDL_cocoavideo.m  | 13 ++++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m
index d84e708c9e82..9ca124c33e8e 100644
--- a/src/video/cocoa/SDL_cocoaevents.m
+++ b/src/video/cocoa/SDL_cocoaevents.m
@@ -27,7 +27,6 @@
 
 #ifndef MAC_OS_X_VERSION_10_12
 #define NSEventTypeApplicationDefined NSApplicationDefined
-typedef NSString *NSKeyValueChangeKey;
 #endif
 
 static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win)
@@ -132,7 +131,7 @@ - (id)init;
 - (void)localeDidChange:(NSNotification *)notification;
 - (void)observeValueForKeyPath:(NSString *)keyPath 
                       ofObject:(id)object 
-                        change:(NSDictionary<NSKeyValueChangeKey, id> *)change 
+                        change:(NSDictionary *)change 
                        context:(void *)context;
 @end
 
@@ -280,7 +279,7 @@ - (void)localeDidChange:(NSNotification *)notification
 
 - (void)observeValueForKeyPath:(NSString *)keyPath 
                       ofObject:(id)object 
-                        change:(NSDictionary<NSKeyValueChangeKey, id> *)change 
+                        change:(NSDictionary *)change 
                        context:(void *)context
 {
     SDL_SetSystemTheme(Cocoa_GetSystemTheme());
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index 48df62e18a2e..f0a7b5162b39 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -226,13 +226,16 @@ void Cocoa_VideoQuit(_THIS)
 /* This function assumes that it's called from within an autorelease pool */
 SDL_SystemTheme Cocoa_GetSystemTheme(void)
 {
-    NSAppearance* appearance = [[NSApplication sharedApplication] effectiveAppearance];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 /* Added in the 10.14.0 SDK. */
+    if ([[NSApplication sharedApplication] respondsToSelector:@selector(effectiveAppearance)]) {
+        NSAppearance* appearance = [[NSApplication sharedApplication] effectiveAppearance];
 
-    if ([appearance.name containsString: @"Dark"]) {
-        return SDL_SYSTEM_THEME_DARK;
-    } else {
-        return SDL_SYSTEM_THEME_LIGHT;
+        if ([appearance.name containsString: @"Dark"]) {
+            return SDL_SYSTEM_THEME_DARK;
+        }
     }
+#endif
+    return SDL_SYSTEM_THEME_LIGHT;
 }
 
 /* This function assumes that it's called from within an autorelease pool */