Filter out problematic shortcut keys

This commit is contained in:
Henrik Rydgård
2026-04-14 18:43:42 -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);
+2 -1
View File
@@ -825,7 +825,8 @@ bool SearchBar::Touch(const TouchInput &input) {
// for the user to be able to get out of searches without knowing ESC (or backspacing the whole search string).
if (input.flags & TouchInputFlags::DOWN) {
if (bounds_.Contains(input.x, input.y)) {
OnCancel.Trigger(UI::EventParams{this});
UI::EventParams params{this};
OnCancel.Trigger(params);
return true;
}
}