From 206c756c0ce88eaac49dd7d31fb07352af150e28 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 11 Oct 2020 00:25:28 -0700 Subject: [PATCH] Fixed nested focus issues for direct focus (i.e. mouse click) instead of incremental (i.e. tab) --- src/musikcube/cursespp/LayoutBase.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/musikcube/cursespp/LayoutBase.cpp b/src/musikcube/cursespp/LayoutBase.cpp index d63401d41..7b4a85471 100755 --- a/src/musikcube/cursespp/LayoutBase.cpp +++ b/src/musikcube/cursespp/LayoutBase.cpp @@ -298,6 +298,14 @@ bool LayoutBase::SetFocus(IWindowPtr focus) { else { for (size_t i = 0; i < this->focusable.size(); i++) { if (this->focusable[i] == focus) { + /* if we're focused, we need to ensure our parent sets its correct + focus index to us! and so on up to the root view. note that this + needs to be called before updating our internal focus; recursively, + parents need to have their focus index set before children */ + auto asLayout = dynamic_cast(this->GetParent()); + if (asLayout) { + asLayout->SetFocus(shared_from_this()); + } this->focused = i; this->EnsureValidFocus(); return true;