mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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:
+4
-2
@@ -1639,12 +1639,14 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
|
|||||||
}
|
}
|
||||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
- (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
|
// 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) {
|
if (open_cb) {
|
||||||
fl_lock_function();
|
fl_lock_function();
|
||||||
(*open_cb)([filename UTF8String]);
|
(*open_cb)([filename UTF8String]);
|
||||||
|
Fl::flush(); // useful for AppleScript that does not break the event loop
|
||||||
fl_unlock_function();
|
fl_unlock_function();
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user