From 6162cd1c1947d9f254a9f0433fc145ecb7e17b72 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 26 Jul 2017 21:53:27 +0100 Subject: [PATCH] OSX: Set focus back to the ScummVM window when closing the native file browser --- gui/browser_osx.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm index 6c5f036e8f6..9bc163cf8f6 100644 --- a/gui/browser_osx.mm +++ b/gui/browser_osx.mm @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -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