Skip to content

Commit

Permalink
Allow compilation with SDK 10.10 and use new API to identify OS versi…
Browse files Browse the repository at this point in the history
…on at runtime.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10304 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Sep 13, 2014
1 parent 9523691 commit 6482acf
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Fl_cocoa.mm
Expand Up @@ -1401,7 +1401,7 @@ void fl_open_display() {
if (need_new_nsapp) [NSApplication sharedApplication];
NSAutoreleasePool *localPool;
localPool = [[NSAutoreleasePool alloc] init]; // never released
[NSApp setDelegate:[[FLAppDelegate alloc] init]];
[(NSApplication*)NSApp setDelegate:[[FLAppDelegate alloc] init]];
if (need_new_nsapp) [NSApp finishLaunching];

// empty the event queue but keep system events for drag&drop of files at launch
Expand Down Expand Up @@ -3870,9 +3870,17 @@ Window fl_xid(const Fl_Window* w)
static int calc_mac_os_version() {
int M, m, b = 0;
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
NSDictionary * sv = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
const char *s = [[sv objectForKey:@"ProductVersion"] UTF8String];
sscanf(s, "%d.%d.%d", &M, &m, &b);
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
M = version.majorVersion;
m = version.minorVersion;
b = version.patchVersion;
}
else {
NSDictionary * sv = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
const char *s = [[sv objectForKey:@"ProductVersion"] UTF8String];
sscanf(s, "%d.%d.%d", &M, &m, &b);
}
[localPool release];
return M*10000 + m*100 + b;
}
Expand Down

0 comments on commit 6482acf

Please sign in to comment.