From 6527087b1e6a37b7ea228bf79ec0f319c731b4aa Mon Sep 17 00:00:00 2001 From: Michael Labbe Date: Mon, 15 Aug 2016 14:23:41 -0700 Subject: [PATCH] Issue #7 focus for Mac Window fix --- src/nfd_cocoa.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nfd_cocoa.m b/src/nfd_cocoa.m index a73e15714..c454d329e 100644 --- a/src/nfd_cocoa.m +++ b/src/nfd_cocoa.m @@ -122,7 +122,8 @@ nfdresult_t NFD_OpenDialog( const char *filterList, nfdchar_t **outPath ) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + + NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; NSOpenPanel *dialog = [NSOpenPanel openPanel]; [dialog setAllowsMultipleSelection:NO]; @@ -152,6 +153,7 @@ nfdresult_t NFD_OpenDialog( const char *filterList, } [pool release]; + [keyWindow makeKeyAndOrderFront:nil]; return nfdResult; }