diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-12-07 17:17:30 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-12-07 17:17:30 +1100 |
| commit | aaa949f71805e2040c7ee9a4d0a3c260de95a6d0 (patch) | |
| tree | b31febc367766caf49140a13b2d791cfd4d33616 /src/ui | |
| parent | 3f7f199cb940c8d5f6d48f77fd59971adffe49ef (diff) | |
| parent | 852ce7b91790bc48aa7340527bd5f5ce53147492 (diff) | |
| download | tangara-fw-aaa949f71805e2040c7ee9a4d0a3c260de95a6d0.tar.gz | |
Merge branch 'main' of git.sr.ht:~jacqueline/tangara-fw
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/encoder_input.cpp | 20 | ||||
| -rw-r--r-- | src/ui/include/ui_fsm.hpp | 1 | ||||
| -rw-r--r-- | src/ui/ui_fsm.cpp | 6 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/ui/encoder_input.cpp b/src/ui/encoder_input.cpp index b27c2862..39aacc0c 100644 --- a/src/ui/encoder_input.cpp +++ b/src/ui/encoder_input.cpp @@ -264,6 +264,26 @@ auto EncoderInput::Read(lv_indev_data_t* data) -> void { break; } + // Only trigger the directional long-press gestures if they trigger at the + // same time as a trigger on the overall touchwheel. This means the + // gestures only trigger if it's your only interaction with the wheel this + // press; scrolling and then resting on a direction should not trigger + // them. + trigger = TriggerKey(Keys::kTouchWheel, KeyStyle::kLongPress, now_ms); + if (trigger == Trigger::kLongPress) { + trigger = + TriggerKey(Keys::kDirectionalLeft, KeyStyle::kLongPress, now_ms); + switch (trigger) { + case Trigger::kNone: + break; + case Trigger::kClick: + break; + case Trigger::kLongPress: + events::Ui().Dispatch(internal::BackPressed{}); + break; + } + } + break; } } diff --git a/src/ui/include/ui_fsm.hpp b/src/ui/include/ui_fsm.hpp index f5f8c574..7ad6be93 100644 --- a/src/ui/include/ui_fsm.hpp +++ b/src/ui/include/ui_fsm.hpp @@ -129,6 +129,7 @@ class Lua : public UiState { void react(const audio::PlaybackStarted&) override; void react(const audio::PlaybackUpdate&) override; void react(const audio::PlaybackFinished&) override; + void react(const internal::BackPressed&) override; using UiState::react; diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index 9fc31481..783494dd 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -242,7 +242,7 @@ auto Lua::PushLuaScreen(lua_State* s) -> int { return 0; } -auto Lua::PopLuaScreen(lua_State* s) -> int { +auto Lua::PopLuaScreen(lua_State *s) -> int { PopScreen(); luavgl_set_root(s, sCurrentScreen->content()); lv_group_set_default(sCurrentScreen->group()); @@ -303,6 +303,10 @@ void Lua::react(const audio::PlaybackFinished&) { playback_playing_->Update(false); } +void Lua::react(const internal::BackPressed& ev) { + PopLuaScreen(sLua->state()); +} + void Browse::entry() {} void Browse::react(const internal::ShowSettingsPage& ev) { |
