Fix touchevent tap

This commit is contained in:
Riku Isokoski 2021-06-11 13:26:28 +03:00
parent 79f0fcb07a
commit 123c6f1917
3 changed files with 7 additions and 15 deletions

View file

@ -162,7 +162,8 @@ void DisplayApp::Refresh() {
case Messages::TouchEvent: { case Messages::TouchEvent: {
if (state != States::Running) if (state != States::Running)
break; break;
auto gesture = OnTouchEvent(); auto info = touchPanel.GetTouchInfo();
auto gesture = OnTouchEvent(info);
if (!currentScreen->OnTouchEvent(gesture)) { if (!currentScreen->OnTouchEvent(gesture)) {
if (currentApp == Apps::Clock) { if (currentApp == Apps::Clock) {
switch (gesture) { switch (gesture) {
@ -183,6 +184,8 @@ void DisplayApp::Refresh() {
} }
} else if (returnTouchEvent == gesture) { } else if (returnTouchEvent == gesture) {
LoadApp(returnToApp, returnDirection); LoadApp(returnToApp, returnDirection);
} else if (touchMode == TouchModes::Gestures) {
lvgl.SetNewTapEvent(info.x, info.y);
} }
} }
} break; } break;
@ -368,14 +371,10 @@ void DisplayApp::PushMessage(Messages msg) {
} }
} }
TouchEvents DisplayApp::OnTouchEvent() { TouchEvents DisplayApp::OnTouchEvent(Pinetime::Drivers::Cst816S::TouchInfos info) {
auto info = touchPanel.GetTouchInfo();
if (info.isTouch) { if (info.isTouch) {
switch (info.gesture) { switch (info.gesture) {
case Pinetime::Drivers::Cst816S::Gestures::SingleTap: case Pinetime::Drivers::Cst816S::Gestures::SingleTap:
if (touchMode == TouchModes::Gestures) {
lvgl.SetNewTapEvent(info.x, info.y);
}
return TouchEvents::Tap; return TouchEvents::Tap;
case Pinetime::Drivers::Cst816S::Gestures::LongPress: case Pinetime::Drivers::Cst816S::Gestures::LongPress:
return TouchEvents::LongTap; return TouchEvents::LongTap;

View file

@ -100,7 +100,7 @@ namespace Pinetime {
TouchModes touchMode = TouchModes::Gestures; TouchModes touchMode = TouchModes::Gestures;
TouchEvents OnTouchEvent(); TouchEvents OnTouchEvent(Pinetime::Drivers::Cst816S::TouchInfos);
void RunningState(); void RunningState();
void IdleState(); void IdleState();
static void Process(void* instance); static void Process(void* instance);

View file

@ -155,14 +155,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
} }
bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) { return false;
case Pinetime::Applications::TouchEvents::SwipeLeft:
running = false;
return false;
default:
return true;
}
} }
bool QuickSettings::Refresh() { bool QuickSettings::Refresh() {