mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-03 11:15:20 +02:00
Fix audio focus issue by tracking the cause of lost focus.
Fixes #21643
This commit is contained in:
@@ -153,15 +153,16 @@ void SingleControlMapper::Refresh() {
|
||||
void SingleControlMapper::OnReplace(UI::EventParams ¶ms) {
|
||||
const int index = atoi(params.v->Tag().c_str());
|
||||
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, [this, index](KeyMap::MultiInputMapping mapping) {
|
||||
using namespace UI;
|
||||
if (mapping.empty())
|
||||
return;
|
||||
bool success = KeyMap::ReplaceSingleKeyMapping(pspKey_, index, mapping);
|
||||
if (!success) {
|
||||
replaceAllButton_->SetFocus(); // Last got removed as a duplicate
|
||||
replaceAllButton_->SetFocus(FocusFlags::CAUSE_FORCED); // Last got removed as a duplicate
|
||||
} else if (index < (int)rows_.size()) {
|
||||
rows_[index]->SetFocus();
|
||||
rows_[index]->SetFocus(FocusFlags::CAUSE_FORCED);
|
||||
} else {
|
||||
SetFocus();
|
||||
SetFocus(FocusFlags::CAUSE_FORCED);
|
||||
}
|
||||
KeyMap::UpdateNativeMenuKeys();
|
||||
g_IsMappingMouseInput = false;
|
||||
@@ -173,7 +174,7 @@ void SingleControlMapper::OnReplaceAll(UI::EventParams ¶ms) {
|
||||
if (mapping.empty())
|
||||
return;
|
||||
KeyMap::SetInputMapping(pspKey_, mapping, true);
|
||||
replaceAllButton_->SetFocus();
|
||||
replaceAllButton_->SetFocus(UI::FocusFlags::CAUSE_FORCED);
|
||||
KeyMap::UpdateNativeMenuKeys();
|
||||
g_IsMappingMouseInput = false;
|
||||
}, I18NCat::KEYMAPPING));
|
||||
@@ -184,7 +185,7 @@ void SingleControlMapper::OnAdd(UI::EventParams ¶ms) {
|
||||
if (mapping.empty())
|
||||
return;
|
||||
KeyMap::SetInputMapping(pspKey_, mapping, false);
|
||||
addButton_->SetFocus();
|
||||
addButton_->SetFocus(UI::FocusFlags::CAUSE_FORCED);
|
||||
KeyMap::UpdateNativeMenuKeys();
|
||||
g_IsMappingMouseInput = false;
|
||||
}, I18NCat::KEYMAPPING));
|
||||
@@ -196,7 +197,7 @@ void SingleControlMapper::OnAddMouse(UI::EventParams ¶ms) {
|
||||
if (mapping.empty())
|
||||
return;
|
||||
KeyMap::SetInputMapping(pspKey_, mapping, false);
|
||||
addButton_->SetFocus();
|
||||
addButton_->SetFocus(UI::FocusFlags::CAUSE_FORCED);
|
||||
KeyMap::UpdateNativeMenuKeys();
|
||||
g_IsMappingMouseInput = false;
|
||||
}, I18NCat::KEYMAPPING));
|
||||
@@ -206,9 +207,9 @@ void SingleControlMapper::OnDelete(UI::EventParams ¶ms) {
|
||||
int index = atoi(params.v->Tag().c_str());
|
||||
KeyMap::DeleteNthMapping(pspKey_, index);
|
||||
if (index + 1 < (int)rows_.size())
|
||||
rows_[index]->SetFocus();
|
||||
rows_[index]->SetFocus(UI::FocusFlags::CAUSE_FORCED);
|
||||
else
|
||||
SetFocus();
|
||||
SetFocus(UI::FocusFlags::CAUSE_FORCED);
|
||||
}
|
||||
|
||||
struct BindingCategory {
|
||||
@@ -807,7 +808,7 @@ void MockPSP::SelectButton(int btn) {
|
||||
void MockPSP::FocusButton(int btn) {
|
||||
MockButton *view = buttons_[btn];
|
||||
if (view) {
|
||||
view->SetFocus();
|
||||
view->SetFocus(UI::FocusFlags::CAUSE_FORCED);
|
||||
} else {
|
||||
labelView_->SetVisibility(UI::V_GONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user