mirror of https://github.com/fltk/fltk
launching a binary from the command line hangs on macOS Sonoma (#799)
This commit is contained in:
parent
9f141aefc6
commit
c27009e52c
|
@ -1799,12 +1799,7 @@ void Fl_Cocoa_Screen_Driver::open_display_platform() {
|
||||||
FLAppDelegate *delegate = (Fl_Darwin_System_Driver::calc_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]];
|
[(NSApplication*)NSApp setDelegate:[delegate init]];
|
||||||
if (need_new_nsapp) {
|
if (need_new_nsapp) {
|
||||||
BOOL condition = (fl_mac_os_version >= 101300);
|
if (fl_mac_os_version >= 101300 && fl_mac_os_version < 140000 && is_bundled()) {
|
||||||
if (fl_mac_os_version >= 140000) { // hack to detect if app is started by Xcode
|
|
||||||
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
|
|
||||||
condition = (environment[@"__XCODE_BUILT_PRODUCTS_DIR_PATHS"] != nil);
|
|
||||||
}
|
|
||||||
if (condition && is_bundled() ) {
|
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
in_nsapp_run = true;
|
in_nsapp_run = true;
|
||||||
[NSApp run];
|
[NSApp run];
|
||||||
|
@ -1820,15 +1815,15 @@ void Fl_Cocoa_Screen_Driver::open_display_platform() {
|
||||||
dequeue:NO];
|
dequeue:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fl_mac_os_version < 140000) {
|
||||||
// empty the event queue but keep system events for drag&drop of files at launch
|
// empty the event queue but keep system events for drag&drop of files at launch
|
||||||
NSEvent *ign_event;
|
NSEvent *ign_event;
|
||||||
do ign_event = [NSApp nextEventMatchingMask:(NSEventMaskAny & ~NSEventMaskSystemDefined)
|
do ign_event = [NSApp nextEventMatchingMask:(NSEventMaskAny & ~NSEventMaskSystemDefined)
|
||||||
untilDate:[NSDate dateWithTimeIntervalSinceNow:0]
|
untilDate:[NSDate dateWithTimeIntervalSinceNow:0]
|
||||||
inMode:NSDefaultRunLoopMode
|
inMode:NSDefaultRunLoopMode
|
||||||
dequeue:YES];
|
dequeue:YES];
|
||||||
while (ign_event);
|
while (ign_event);
|
||||||
|
}
|
||||||
if (![NSApp isActive]) foreground_and_activate();
|
if (![NSApp isActive]) foreground_and_activate();
|
||||||
if (![NSApp servicesMenu]) createAppleMenu();
|
if (![NSApp servicesMenu]) createAppleMenu();
|
||||||
else Fl_Sys_Menu_Bar::window_menu_style(Fl_Sys_Menu_Bar::no_window_menu);
|
else Fl_Sys_Menu_Bar::window_menu_style(Fl_Sys_Menu_Bar::no_window_menu);
|
||||||
|
|
Loading…
Reference in New Issue