From 2ebc1bc22f1e358b448d8dc209412b6114ce4b4e Mon Sep 17 00:00:00 2001 From: "Yaya.Cout" <67095734+Yaya-Cout@users.noreply.github.com> Date: Wed, 30 Mar 2022 19:21:44 +0200 Subject: [PATCH] [apps] Add Shift + EE to go to the settings Before, EE go to the settings, because ShiftEE event wasn't correctly bound : It was bound to a simple press of the key, and not to a Shift press. This commit keep this behavior, but add the correct binding (Shift + EE). This fix #194. --- apps/apps_container.cpp | 9 +++++++++ ion/include/ion/events.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 1bb917ddc..abb0c0a88 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -243,15 +243,18 @@ bool AppsContainer::processEvent(Ion::Events::Event event) { } return true; } + // If key home or key back is pressed, we switch to the home app. if (event == Ion::Events::Home || event == Ion::Events::Back) { switchTo(appSnapshotAtIndex(0)); return true; } + // If shift + Home are pressed, we switch to the first app. if (event == Ion::Events::ShiftHome) { switchTo(appSnapshotAtIndex(1)); return true; } + // Iterate through the switch events to find the one that matches the event, if one match, switch to the app at the index of the switch event. for(int i = 0; i < std::min((int) (sizeof(switch_events) / sizeof(Ion::Events::Event)), APPS_CONTAINER_SNAPSHOT_COUNT); i++) { if (event == switch_events[i]) { m_window.redraw(true); @@ -260,6 +263,12 @@ bool AppsContainer::processEvent(Ion::Events::Event event) { } } + // Add EE shortcut to go to the settings (app number 12) + if (event == Ion::Events::EE) { + switchTo(appSnapshotAtIndex(12)); + return true; + } + if (event == Ion::Events::OnOff) { suspend(true); return true; diff --git a/ion/include/ion/events.h b/ion/include/ion/events.h index 394271cf2..51c8da397 100644 --- a/ion/include/ion/events.h +++ b/ion/include/ion/events.h @@ -171,7 +171,7 @@ constexpr Event DoubleParenthesis = Event::ShiftKey(Keyboard::Key::LeftParenthes constexpr Event ShiftZero = Event::ShiftKey(Keyboard::Key::Zero); constexpr Event ShiftDot = Event::ShiftKey(Keyboard::Key::Dot); -constexpr Event ShiftEE = Event::PlainKey(Keyboard::Key::EE); +constexpr Event ShiftEE = Event::ShiftKey(Keyboard::Key::EE); constexpr Event ShiftOne = Event::ShiftKey(Keyboard::Key::One); constexpr Event ShiftTwo = Event::ShiftKey(Keyboard::Key::Two);