summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2015-12-23 07:34:49 +0000
committerManolo Gouy <Manolo>2015-12-23 07:34:49 +0000
commit527d5943d039d17a3c88662170b317609ed0e3c8 (patch)
tree7ee055aaa47b2c31031b2b711cffbfe2ca54670b /src
parentca5811e8bcfa1f15128cc38576d5fa01b91ec5ee (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm6
1 files changed, 4 insertions, 2 deletions
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;
}