summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp61
-rw-r--r--src/displayapp/DisplayApp.h1
-rw-r--r--src/displayapp/screens/FlashLight.cpp2
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp9
4 files changed, 33 insertions, 40 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:
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index f4573ab7..574be63f 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -102,7 +102,6 @@ namespace Pinetime {
TouchModes touchMode = TouchModes::Gestures;
- TouchEvents OnTouchEvent();
void RunningState();
void IdleState();
static void Process(void* instance);
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 7db2c6c8..63b2345e 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -70,5 +70,5 @@ bool FlashLight::Refresh() {
}
bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- return true;
+ return false;
}
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index acc2a27a..3fb9c70b 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -155,14 +155,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
}
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
- switch (event) {
- case Pinetime::Applications::TouchEvents::SwipeLeft:
- running = false;
- return false;
-
- default:
- return true;
- }
+ return false;
}
bool QuickSettings::Refresh() {