Fix a Mac OS bug appeared with OS X 10.8: when a file is dragged on the application icon,

a delay of several seconds occur until the first application window opens (cont'd).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9716 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2012-11-13 09:34:54 +00:00
parent e8f8434054
commit 82878a7225

View File

@ -982,6 +982,7 @@ void fl_open_callback(void (*cb)(const char *)) {
<NSWindowDelegate, NSApplicationDelegate>
#endif
{
BOOL seen_open_file;
}
- (void)windowDidMove:(NSNotification *)notif;
- (void)windowDidResize:(NSNotification *)notif;
@ -1256,6 +1257,7 @@ void fl_open_callback(void (*cb)(const char *)) {
}
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
seen_open_file = YES;
if (open_cb) {
fl_lock_function();
(*open_cb)([filename UTF8String]);
@ -1268,7 +1270,7 @@ void fl_open_callback(void (*cb)(const char *)) {
{
// without this, 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
if (fl_mac_os_version >= 100800) [[NSApp mainWindow] orderFront:nil];
if (fl_mac_os_version >= 100800 && seen_open_file) [[NSApp mainWindow] orderFront:self];
}
@end