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