MacOS: support running fl_open_display() in static initializer.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12583 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2017-12-06 07:38:05 +00:00
parent fdbee3daed
commit 24a5fa7632

View File

@ -1768,7 +1768,7 @@ void Fl_Cocoa_Screen_Driver::open_display_platform() {
if (need_new_nsapp) [NSApplication sharedApplication];
NSAutoreleasePool *localPool;
localPool = [[NSAutoreleasePool alloc] init]; // never released
FLAppDelegate *delegate = (fl_mac_os_version < 100500 ? [FLAppDelegateBefore10_5 alloc] : [FLAppDelegate alloc]);
FLAppDelegate *delegate = (Fl_Darwin_System_Driver::calc_mac_os_version() < 100500 ? [FLAppDelegateBefore10_5 alloc] : [FLAppDelegate alloc]);
[(NSApplication*)NSApp setDelegate:[delegate init]];
if (need_new_nsapp) {
if (fl_mac_os_version >= 101300 ) {
@ -3778,7 +3778,7 @@ static void createAppleMenu(void)
NSMenuItem *menuItem;
NSString *title;
SEL infodictSEL = (Fl_Darwin_System_Driver::calc_mac_os_version() >= 100200 ? @selector(localizedInfoDictionary) : @selector(infoDictionary));
SEL infodictSEL = (fl_mac_os_version >= 100200 ? @selector(localizedInfoDictionary) : @selector(infoDictionary));
NSString *nsappname = [[[NSBundle mainBundle] performSelector:infodictSEL] objectForKey:@"CFBundleName"];
if (nsappname == nil)
nsappname = [[NSProcessInfo processInfo] processName];