diff options
author | Thierry Crozat | 2017-07-26 21:50:32 +0100 |
---|---|---|
committer | Thierry Crozat | 2017-07-26 21:50:32 +0100 |
commit | b8c2f26098640374a0ccc784ff49ef51307cb6e5 (patch) | |
tree | 908d91277295d4e4a64eed4270b4aeb517a7544c | |
parent | b8142ff362668bdf3880a0de2e1531a292cbc785 (diff) | |
download | scummvm-rg350-b8c2f26098640374a0ccc784ff49ef51307cb6e5.tar.gz scummvm-rg350-b8c2f26098640374a0ccc784ff49ef51307cb6e5.tar.bz2 scummvm-rg350-b8c2f26098640374a0ccc784ff49ef51307cb6e5.zip |
OSX: Clear pending events when closing the native file browser
This is to avoid dispatching to ScummVM events that were intended for
the NSOpenPanel dialog.
-rw-r--r-- | gui/browser_osx.mm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm index cfb70a3f65..6c5f036e8f 100644 --- a/gui/browser_osx.mm +++ b/gui/browser_osx.mm @@ -29,6 +29,7 @@ #include "common/system.h" #include "common/algorithm.h" #include "common/translation.h" +#include "common/events.h" #include <AppKit/NSNibDeclarations.h> #include <AppKit/NSOpenPanel.h> @@ -170,6 +171,14 @@ int BrowserDialog::runModal() { [showHiddenFilesButton release]; [showHiddenFilesController release]; + // 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 + // intended for the native file browser. For example: pressing Esc to cancel the native + // macOS file browser would cause the application to quit in addition to closing the + // file browser. To avoid this happening clear all pending vents. + g_system->getEventManager()->getEventDispatcher()->clearEvents(); + // If we were in fullscreen mode, switch back if (wasFullscreen) { g_system->beginGFXTransaction(); |