Filter out problematic shortcut keys

This commit is contained in:
Henrik Rydgård
2026-04-14 19:44:20 -06:00
parent 07df47de07
commit b5bc36a37f
2 changed files with 21 additions and 1 deletions
+19
View File
@@ -115,6 +115,19 @@ bool HasMainButtonMapping(const std::vector<InputMapping> &mappings) {
return false;
}
static void RemoveKeyboardLetterKeys(std::vector<InputMapping> &mappings) {
std::vector<InputMapping> result;
for (auto &mapping : mappings) {
if (mapping.deviceId == DEVICE_ID_KEYBOARD) {
if (mapping.keyCode >= NKCODE_A && mapping.keyCode <= NKCODE_Z) {
continue;
}
}
result.push_back(mapping);
}
mappings = result;
}
// TODO: This is such a mess...
void UpdateNativeMenuKeys() {
std::vector<InputMapping> confirmKeys, cancelKeys;
@@ -194,6 +207,12 @@ void UpdateNativeMenuKeys() {
}
*/
// Remove keyboard letter keys from some arrays, as they will collide with text input for instant search.
RemoveKeyboardLetterKeys(tabLeft);
RemoveKeyboardLetterKeys(tabRight);
RemoveKeyboardLetterKeys(confirmKeys);
RemoveKeyboardLetterKeys(cancelKeys);
SetDPadKeys(upKeys, downKeys, leftKeys, rightKeys);
SetConfirmCancelKeys(confirmKeys, cancelKeys);
SetTabLeftRightKeys(tabLeft, tabRight);