diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-12-06 10:50:37 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-12-06 10:50:37 +1100 |
| commit | 852ce7b91790bc48aa7340527bd5f5ce53147492 (patch) | |
| tree | 787eaeca62e437c736ab72c0b3c97010ca472cb2 /src/ui/encoder_input.cpp | |
| parent | 5b272af5454a274524b47d91f2387e7bb0b9a0c0 (diff) | |
| download | tangara-fw-852ce7b91790bc48aa7340527bd5f5ce53147492.tar.gz | |
Add a back button gesture in clickwheel mode
Diffstat (limited to 'src/ui/encoder_input.cpp')
| -rw-r--r-- | src/ui/encoder_input.cpp | 20 |
1 files changed, 20 insertions, 0 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; } } |
