aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/browser_osx.mm5
1 files changed, 5 insertions, 0 deletions
diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm
index 6c5f036e8f..9bc163cf8f 100644
--- a/gui/browser_osx.mm
+++ b/gui/browser_osx.mm
@@ -33,6 +33,7 @@
#include <AppKit/NSNibDeclarations.h>
#include <AppKit/NSOpenPanel.h>
+#include <AppKit/NSApplication.h>
#include <AppKit/NSButton.h>
#include <Foundation/NSString.h>
#include <Foundation/NSURL.h>
@@ -125,6 +126,8 @@ int BrowserDialog::runModal() {
// Temporarily show the real mouse
CGDisplayShowCursor(kCGDirectMainDisplay);
+ NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow];
+
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:!_isDirBrowser];
[panel setCanChooseDirectories:_isDirBrowser];
@@ -171,6 +174,8 @@ int BrowserDialog::runModal() {
[showHiddenFilesButton release];
[showHiddenFilesController release];
+ [keyWindow makeKeyAndOrderFront:nil];
+
// While the native macOS file browser is open, any input events (e.g. keypresses) are
// still received by the NSApplication. With SDL backend for example this results in the
// events beeing queued and processed after we return, thus dispatching events that were