From 527d5943d039d17a3c88662170b317609ed0e3c8 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 23 Dec 2015 07:34:49 +0000 Subject: Mac OS: when an app is asked to open a file by Applescript, have it redraw itself without waiting for the next event to come, because AppleScript does not break the event loop. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10978 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 7e2ce76fd..9dc157424 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1639,12 +1639,14 @@ static FLWindowDelegate *flwindowdelegate_instance = nil; } - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { - // without the next statement, the opening of the 1st window is delayed by several seconds + // without the next two statements, the opening of the 1st window is delayed by several seconds // under Mac OS ≥ 10.8 when a file is dragged on the application icon - [[theApplication mainWindow] orderFront:self]; + Fl_Window *firstw = Fl::first_window(); + if (firstw) firstw->wait_for_expose(); if (open_cb) { fl_lock_function(); (*open_cb)([filename UTF8String]); + Fl::flush(); // useful for AppleScript that does not break the event loop fl_unlock_function(); return YES; } -- cgit v1.2.3