diff options
author | Thierry Crozat | 2017-07-26 21:53:27 +0100 |
---|---|---|
committer | Thierry Crozat | 2017-07-26 23:08:39 +0100 |
commit | 6162cd1c1947d9f254a9f0433fc145ecb7e17b72 (patch) | |
tree | 036e6c7f1a648ae8bba3ad2a91d174af483ead94 | |
parent | b8c2f26098640374a0ccc784ff49ef51307cb6e5 (diff) | |
download | scummvm-rg350-6162cd1c1947d9f254a9f0433fc145ecb7e17b72.tar.gz scummvm-rg350-6162cd1c1947d9f254a9f0433fc145ecb7e17b72.tar.bz2 scummvm-rg350-6162cd1c1947d9f254a9f0433fc145ecb7e17b72.zip |
OSX: Set focus back to the ScummVM window when closing the native file browser
-rw-r--r-- | gui/browser_osx.mm | 5 |
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 |