Przeglądaj źródła

Fix https://bugzilla.libsdl.org/show_bug.cgi?id=4877#c2

loadNibNamed:owner:topLevelObjects is available on 10.8 and newer.
There is an issue report here about an app failing to function on
10.7 and earlier: https://discourse.libsdl.org/t/28179
Ozkan Sezer 4 lat temu
rodzic
commit
69fbd60d25
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      src/video/cocoa/SDL_cocoaevents.m

+ 7 - 1
src/video/cocoa/SDL_cocoaevents.m

@@ -33,6 +33,9 @@
 #ifndef kIOPMAssertPreventUserIdleDisplaySleep
 #define kIOPMAssertPreventUserIdleDisplaySleep kIOPMAssertionTypePreventUserIdleDisplaySleep
 #endif
+#ifndef NSAppKitVersionNumber10_8
+#define NSAppKitVersionNumber10_8 1187
+#endif
 
 @interface SDLApplication : NSApplication
 
@@ -306,7 +309,10 @@ LoadMainMenuNibIfAvailable(void)
     NSDictionary *infoDict;
     NSString *mainNibFileName;
     bool success = false;
-    
+
+    if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_8) {
+        return false;
+    }
     infoDict = [[NSBundle mainBundle] infoDictionary];
     if (infoDict) {
         mainNibFileName = [infoDict valueForKey:@"NSMainNibFile"];