From b11af6e5e1bbd2ec95368cc6f45f3306a4f056c2 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 9 Dec 2013 12:12:26 +0000 Subject: Simplified the code that supports application opening by dropping file onto icon. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10024 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index c14f604db..9ae096481 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1087,7 +1087,6 @@ static void cocoaMouseHandler(NSEvent *theEvent) #endif { - BOOL seen_open_file; void (*open_cb)(const char*); } - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; @@ -1097,7 +1096,6 @@ static void cocoaMouseHandler(NSEvent *theEvent) - (void)applicationWillHide:(NSNotification *)notify; - (void)applicationWillUnhide:(NSNotification *)notify; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; - (void)open_cb:(void (*)(const char*))cb; @end @implementation FLAppDelegate @@ -1241,7 +1239,9 @@ static void cocoaMouseHandler(NSEvent *theEvent) } - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { - seen_open_file = YES; + // without the next statement, 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]; if (open_cb) { fl_lock_function(); (*open_cb)([filename UTF8String]); @@ -1250,12 +1250,6 @@ static void cocoaMouseHandler(NSEvent *theEvent) } return NO; } -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification -{ - // 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 && seen_open_file) [[NSApp mainWindow] orderFront:self]; -} - (void)open_cb:(void (*)(const char*))cb { open_cb = cb; -- cgit v1.2.3