From b06b3db1d427a0d3b86c86f1f22fad472176ba29 Mon Sep 17 00:00:00 2001 From: Nathan Fulton Date: Mon, 12 Sep 2016 10:40:36 -0400 Subject: [PATCH] Process SDL_KEYUP for SDLK_AC_BACK This prevents SDLK_AC_BACK from getting processed multiple times if an Android user holds their finger on the hardware back button. --- game/sdl/host.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/game/sdl/host.cpp b/game/sdl/host.cpp index 4dfbe13..b17700f 100644 --- a/game/sdl/host.cpp +++ b/game/sdl/host.cpp @@ -324,10 +324,6 @@ bool ProcessSdlEvent(base::Message *pmsg, Event *pevt) pevt->chr = chrDelete; break; - case SDLK_AC_BACK: - pevt->chr = vchrBack; - break; - #if 0 case SDLK_F7: if (gpavir == NULL) { @@ -386,6 +382,21 @@ bool ProcessSdlEvent(base::Message *pmsg, Event *pevt) } break; + case SDL_KEYUP: + // pevt->eType = keyUpEvent; + switch (event.key.keysym.sym) { + + case SDLK_AC_BACK: + pevt->eType = keyDownEvent; + pevt->chr = vchrBack; + break; + + default: + pevt->chr = event.key.keysym.sym; + break; + } + break; + case SDL_APP_DIDENTERFOREGROUND: // Allow the display to render gpdisp->SetShouldRender(true);