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.
This commit is contained in:
antoniou79 2023-08-09 22:19:37 +03:00 committed by Eugene Sandulenko
parent caf5cae277
commit d2865e7dc6

View File

@ -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, _("???"));