fix filebrowser touch (related to f2462cff81).
the fix in commit f2462cff81 broke split screen.
this commit properly fixes the touch and split screen buttons.
This commit is contained in:
@@ -62,6 +62,12 @@ struct Widget : public Object {
|
||||
m_actions.clear();
|
||||
}
|
||||
|
||||
void RemoveActions(const Actions& actions) {
|
||||
for (auto& e : actions) {
|
||||
RemoveAction(e.first);
|
||||
}
|
||||
}
|
||||
|
||||
auto FireAction(Button button, u8 type = ActionType::DOWN) -> bool;
|
||||
|
||||
void SetPop(bool pop = true) {
|
||||
|
||||
@@ -442,8 +442,6 @@ FsView::~FsView() {
|
||||
}
|
||||
|
||||
void FsView::Update(Controller* controller, TouchInfo* touch) {
|
||||
Widget::Update(controller, touch);
|
||||
|
||||
m_list->OnUpdate(controller, touch, m_index, m_entries_current.size(), [this](bool touch, auto i) {
|
||||
if (touch && m_index == i) {
|
||||
FireAction(Button::A);
|
||||
@@ -1892,21 +1890,19 @@ void Menu::Update(Controller* controller, TouchInfo* touch) {
|
||||
// workaround the buttons not being display properly.
|
||||
// basically, inherit all actions from the view, draw them,
|
||||
// then restore state after.
|
||||
// const auto actions_copy = GetActions();
|
||||
// ON_SCOPE_EXIT(m_actions = actions_copy);
|
||||
// m_actions.insert_range(view->GetActions());
|
||||
const auto view_actions = view->GetActions();
|
||||
m_actions.insert_range(view_actions);
|
||||
ON_SCOPE_EXIT(RemoveActions(view_actions));
|
||||
|
||||
MenuBase::Update(controller, touch);
|
||||
view->Update(controller, touch);
|
||||
}
|
||||
|
||||
void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
||||
// workaround the buttons not being display properly.
|
||||
// basically, inherit all actions from the view, draw them,
|
||||
// then restore state after.
|
||||
const auto actions_copy = GetActions();
|
||||
ON_SCOPE_EXIT(m_actions = actions_copy);
|
||||
m_actions.insert_range(view->GetActions());
|
||||
// see Menu::Update().
|
||||
const auto view_actions = view->GetActions();
|
||||
m_actions.insert_range(view_actions);
|
||||
ON_SCOPE_EXIT(RemoveActions(view_actions));
|
||||
|
||||
MenuBase::Draw(vg, theme);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user