mirror of https://github.com/fltk/fltk
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
This commit is contained in:
parent
ca5811e8bc
commit
527d5943d0
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue