summaryrefslogtreecommitdiff
path: root/src/displayapp/DisplayApp.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-07-24 18:46:52 +0200
committerJean-François Milants <jf@codingfield.com>2021-07-24 18:46:52 +0200
commit926553d04386341f60eaf8c2abb3f50c65b8fb04 (patch)
tree6c40390ff67374d7f072423364533ebc85ccbb63 /src/displayapp/DisplayApp.cpp
parentd6cccc2dcd95a7d332ee657d1357ae060389f6e6 (diff)
parent95b8a56dd42da067b56e37111577427518d825fb (diff)
Merge branch 'fix_touchevent_tap' of git://github.com/Riksu9000/InfiniTime into Riksu9000-fix_touchevent_tap
# Conflicts: # src/displayapp/DisplayApp.cpp
Diffstat (limited to 'src/displayapp/DisplayApp.cpp')
-rw-r--r--src/displayapp/DisplayApp.cpp61
1 files changed, 31 insertions, 30 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 4d32a7e5..b0948393 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -52,6 +52,31 @@ namespace {
static inline bool in_isr(void) {
return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
}
+
+ TouchEvents Convert(Pinetime::Drivers::Cst816S::TouchInfos info) {
+ if (info.isTouch) {
+ switch (info.gesture) {
+ case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
+ return TouchEvents::Tap;
+ case Pinetime::Drivers::Cst816S::Gestures::LongPress:
+ return TouchEvents::LongTap;
+ case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
+ return TouchEvents::DoubleTap;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideRight:
+ return TouchEvents::SwipeRight;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideLeft:
+ return TouchEvents::SwipeLeft;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideDown:
+ return TouchEvents::SwipeDown;
+ case Pinetime::Drivers::Cst816S::Gestures::SlideUp:
+ return TouchEvents::SwipeUp;
+ case Pinetime::Drivers::Cst816S::Gestures::None:
+ default:
+ return TouchEvents::None;
+ }
+ }
+ return TouchEvents::None;
+ }
}
DisplayApp::DisplayApp(Drivers::St7789& lcd,
@@ -180,7 +205,8 @@ void DisplayApp::Refresh() {
if (state != States::Running) {
break;
}
- auto gesture = OnTouchEvent();
+ auto info = touchPanel.GetTouchInfo();
+ auto gesture = Convert(info);
if (gesture == TouchEvents::None) {
break;
}
@@ -204,6 +230,10 @@ void DisplayApp::Refresh() {
}
} else if (returnTouchEvent == gesture) {
LoadApp(returnToApp, returnDirection);
+ } else if (touchMode == TouchModes::Gestures) {
+ if (gesture == TouchEvents::Tap) {
+ lvgl.SetNewTapEvent(info.x, info.y);
+ }
}
}
} break;
@@ -400,35 +430,6 @@ void DisplayApp::PushMessage(Messages msg) {
}
}
-TouchEvents DisplayApp::OnTouchEvent() {
- auto info = touchPanel.GetTouchInfo();
- if (info.isTouch) {
- switch (info.gesture) {
- case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
- if (touchMode == TouchModes::Gestures) {
- lvgl.SetNewTapEvent(info.x, info.y);
- }
- return TouchEvents::Tap;
- case Pinetime::Drivers::Cst816S::Gestures::LongPress:
- return TouchEvents::LongTap;
- case Pinetime::Drivers::Cst816S::Gestures::DoubleTap:
- return TouchEvents::DoubleTap;
- case Pinetime::Drivers::Cst816S::Gestures::SlideRight:
- return TouchEvents::SwipeRight;
- case Pinetime::Drivers::Cst816S::Gestures::SlideLeft:
- return TouchEvents::SwipeLeft;
- case Pinetime::Drivers::Cst816S::Gestures::SlideDown:
- return TouchEvents::SwipeDown;
- case Pinetime::Drivers::Cst816S::Gestures::SlideUp:
- return TouchEvents::SwipeUp;
- case Pinetime::Drivers::Cst816S::Gestures::None:
- default:
- return TouchEvents::None;
- }
- }
- return TouchEvents::None;
-}
-
void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) {
switch (direction) {
case DisplayApp::FullRefreshDirections::Down: