diff --git a/src/musikcube/cursespp/LayoutBase.cpp b/src/musikcube/cursespp/LayoutBase.cpp index bd15bd06d..ec8536b49 100755 --- a/src/musikcube/cursespp/LayoutBase.cpp +++ b/src/musikcube/cursespp/LayoutBase.cpp @@ -493,6 +493,19 @@ bool LayoutBase::KeyPress(const std::string& key) { this->FocusNext(); return true; } + /* we find the focus recursively, then let the child deepest in the + hierarchy process the key event. if that fails we move up to its parent, + and so on until we reach ourself. */ + auto focus = this->GetFocus().get(); + while (focus != this) { + auto asKeyHandler = dynamic_cast(focus); + if (asKeyHandler) { + if (asKeyHandler->KeyPress(key)) { + return true; + } + } + focus = focus->GetParent(); + } return false; }