ControlMapping: Fix Autoconfigure in portrait, and Escape on the analog limiter

- In portrait the settings pane is a popup, so it got the list's
  dialogFinished and the pad was never autoconfigured. Use a callback.
- Escape was meant to cancel mapping the analog speed limiter (3cb4207369),
  but since the combo mapping rewrite it got mapped to it instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-22 10:55:30 +02:00
1 parent 8fc75c0344
commit 20686814a3
2 files changed
+9 -12

No files matched your search

+9 -10
View File
@@ -308,20 +308,16 @@ void ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
}
auto km = GetI18NCategory(I18NCat::KEYMAPPING);
auto di = GetI18NCategory(I18NCat::DIALOG);
UI::ListPopupScreen *autoConfList = new UI::ListPopupScreen(km->T("Autoconfigure for device"), items, -1);
// Uses a callback, since in portrait the settings are in a popup, which would get dialogFinished instead of us.
UI::ListPopupScreen *autoConfList = new UI::ListPopupScreen(km->T("Autoconfigure for device"), items, -1, [items](int index) {
KeyMap::AutoConfForPad(items[index]);
});
autoConfList->SetNotification(NoticeLevel::WARN, di->T("This will overwrite the existing configuration"));
if (params.v)
autoConfList->SetPopupOrigin(params.v);
screenManager()->push(autoConfList);
}
void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) {
if (result == DR_OK && !strcmp(dialog->tag(), "listpopup")) {
UI::ListPopupScreen *popup = (UI::ListPopupScreen *)dialog;
KeyMap::AutoConfForPad(popup->GetChoiceString());
}
}
void KeyMappingNewKeyDialog::CreatePopupContents(UI::ViewGroup *parent) {
using namespace UI;
@@ -351,8 +347,11 @@ bool KeyMappingNewKeyDialog::key(const KeyInput &key) {
return true;
}
if (pspBtn_ == VIRTKEY_SPEED_ANALOG && !UI::IsEscapeKey(key)) {
// Only map analog values to this mapping.
if (pspBtn_ == VIRTKEY_SPEED_ANALOG) {
// Only map analog values to this mapping. Escape cancels.
if (UI::IsEscapeKey(key)) {
TriggerFinish(DR_CANCEL);
}
return true;
}