From 01edd695c86e022999937016c7a9f4be0dc6a067 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 29 Aug 2021 17:14:08 -0700 Subject: [PATCH] UI: Fix refocus on no control change. There's no reason to refresh, and since the views are different without PersistData being called, it breaks the focus. Refreshing now handled via the generation value. --- UI/ControlMappingScreen.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 3f09c61bdc..31f7fe761d 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -48,8 +48,8 @@ class SingleControlMapper : public UI::LinearLayout { public: SingleControlMapper(int pspKey, std::string keyName, ScreenManager *scrm, UI::LinearLayoutParams *layoutParams = nullptr); - void Update() override; int GetPspKey() const { return pspKey_; } + private: void Refresh(); @@ -76,7 +76,6 @@ private: int pspKey_; std::string keyName_; ScreenManager *scrm_; - bool refresh_ = false; }; SingleControlMapper::SingleControlMapper(int pspKey, std::string keyName, ScreenManager *scrm, UI::LinearLayoutParams *layoutParams) @@ -84,14 +83,6 @@ SingleControlMapper::SingleControlMapper(int pspKey, std::string keyName, Screen Refresh(); } -void SingleControlMapper::Update() { - if (refresh_) { - refresh_ = false; - Refresh(); - host->UpdateUI(); - } -} - void SingleControlMapper::Refresh() { Clear(); auto mc = GetI18NCategory("MappableControls"); @@ -187,8 +178,6 @@ void SingleControlMapper::MappedCallback(KeyDef kdf) { break; } g_Config.bMapMouse = false; - refresh_ = true; - // After this, we do not exist any more. So the refresh_ = true is probably irrelevant. } UI::EventReturn SingleControlMapper::OnReplace(UI::EventParams ¶ms) { @@ -224,7 +213,6 @@ UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams ¶ms) { int index = atoi(params.v->Tag().c_str()); KeyMap::g_controllerMap[pspKey_].erase(KeyMap::g_controllerMap[pspKey_].begin() + index); KeyMap::g_controllerMapGeneration++; - refresh_ = true; if (index + 1 < rows_.size()) rows_[index]->SetFocus();