diff options
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r-- | src/gui/sdlinput.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 97ac0ac5e..b6fabd8a5 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -91,6 +91,10 @@ PRAGMA48(GCC diagnostic pop) #include "debug.h" +#ifdef __SWITCH__ +bool keyboardClosed = false; +#endif + extern volatile time_t cur_time; SDLInput *guiInput = nullptr; @@ -134,6 +138,20 @@ void SDLInput::pushInput(const SDL_Event &event) KeyInput keyInput; MouseInput mouseInput; +#ifdef __SWITCH__ + // send an escape/cancel key on keyboard dismiss event + bool visible = SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE; + if(visible) + { + keyboardClosed = false; + } + else if(!keyboardClosed) + { + simulateKey(KeyValue::ESCAPE, InputAction::GUI_CANCEL); + keyboardClosed = true; + } +#endif + switch (event.type) { case SDL_KEYDOWN: |