From 69fbd60d2510650d13b92b03b8c4c41ffc0e3383 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 9 Oct 2020 04:00:00 +0300 Subject: [PATCH] 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 --- src/video/cocoa/SDL_cocoaevents.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 8aec00008..43f43925f 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/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"];