From d2865e7dc6c78587b91a0c4fa76eafd80f64bf0c Mon Sep 17 00:00:00 2001 From: antoniou79 Date: Wed, 9 Aug 2023 22:19:37 +0300 Subject: [PATCH] GUI: Add allowKdbRepeats() to up/down/left/right actions in launcher This matches also the behavior as set in engines/metaengine.cpp MetaEngine::initKeymaps() This change is needed at least to avoid a hack on Android. Setting the "kdbRepeat" flag for events of keeping the arrow keys pressed (on the touch virtual keyboard), as Android supports, would not work to eg. keep going through a list upwards or downwards with the respective arrow key pressed. Instead we had to hack the behavior of a physical keyboard which sents multiple keypresses (keydown and keyup events), without setting the kbdRepeat flag. However, this hack would work poorly in some game engines (eg. in LBA while rotating Twinsen, the movement becomes "stuttering"). In-games the kbdRepeat flags is respected already due to the setting in engines/metaengine.cpp (as far as I can tell) and resulting movement is more fluid. --- gui/gui-manager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 30a22e358ad..6a8495ee8ab 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -168,21 +168,25 @@ Common::Keymap *GuiManager::getKeymap() const { act = new Action(kStandardActionMoveUp, _("Up")); act->setKeyEvent(KEYCODE_UP); act->addDefaultInputMapping("JOY_UP"); + act->allowKbdRepeats(); guiMap->addAction(act); act = new Action(kStandardActionMoveDown, _("Down")); act->setKeyEvent(KEYCODE_DOWN); act->addDefaultInputMapping("JOY_DOWN"); + act->allowKbdRepeats(); guiMap->addAction(act); act = new Action(kStandardActionMoveLeft, _("Left")); act->setKeyEvent(KEYCODE_LEFT); act->addDefaultInputMapping("JOY_LEFT"); + act->allowKbdRepeats(); guiMap->addAction(act); act = new Action(kStandardActionMoveRight, _("Right")); act->setKeyEvent(KEYCODE_RIGHT); act->addDefaultInputMapping("JOY_RIGHT"); + act->allowKbdRepeats(); guiMap->addAction(act); act = new Action(kStandardActionEE, _("???"));