diff options
| author | Manolo Gouy <Manolo> | 2017-10-18 12:35:03 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-10-18 12:35:03 +0000 |
| commit | 4ec7403f122a295744043048687a4301ec8fbba5 (patch) | |
| tree | 27ae5d8736d33c059f5024f80656eb5ebff74966 /src | |
| parent | bc42454074073803ad06ca4faa4af555ee5edf34 (diff) | |
MacOS: make sure all files dropped to the app at launch time are open when Fl_Window->wait_for_expose() is used.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12512 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 62f06ff1e..753fef6bc 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -847,19 +847,23 @@ static int do_queued_events( double time = 0.0 ) return got_events; } +static void drain_dropped_files_list() { + open_cb_f_type open_cb = get_open_cb(); + NSString *s; + if ( (s = (NSString*)[dropped_files_list firstObject]) != nil) { + if (open_cb) open_cb([s UTF8String]); + [dropped_files_list removeObjectAtIndex:0]; + } + if ([dropped_files_list count] == 0) { + [dropped_files_list release]; + dropped_files_list = nil; + } +} + double Fl_Cocoa_Screen_Driver::wait(double time_to_wait) { if (dropped_files_list) { // when the list of dropped files is not empty, open one and remove it from list - open_cb_f_type open_cb = get_open_cb(); - NSString *s; - if ( (s = (NSString*)[dropped_files_list firstObject]) != nil) { - if (open_cb) open_cb([s UTF8String]); - [dropped_files_list removeObjectAtIndex:0]; - } - if ([dropped_files_list count] == 0) { - [dropped_files_list release]; - dropped_files_list = nil; - } + drain_dropped_files_list(); } Fl::run_checks(); static int in_idle = 0; @@ -3120,6 +3124,9 @@ void Fl_Cocoa_Window_Driver::wait_for_expose() if (fl_mac_os_version < 101300) { [fl_xid(pWindow) recursivelySendToSubwindows:@selector(waitForExpose)]; } else { + while (dropped_files_list) { + drain_dropped_files_list(); + } [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO]; } |
