diff options
| author | Manolo Gouy <Manolo> | 2013-12-09 12:12:26 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2013-12-09 12:12:26 +0000 |
| commit | b11af6e5e1bbd2ec95368cc6f45f3306a4f056c2 (patch) | |
| tree | 2b66e35d5608cbd8764a229d82919761db41c608 | |
| parent | 076de1c617c9c8aec6da2af732a0e29e58a1f315 (diff) | |
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
| -rw-r--r-- | src/Fl_cocoa.mm | 12 |
1 files 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) <NSApplicationDelegate> #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; |
