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

View File

@ -100,7 +100,7 @@ namespace Pinetime {
TouchModes touchMode = TouchModes::Gestures;
TouchEvents OnTouchEvent();
TouchEvents OnTouchEvent(Pinetime::Drivers::Cst816S::TouchInfos);
void RunningState();
void IdleState();
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) {
switch (event) {
case Pinetime::Applications::TouchEvents::SwipeLeft:
running = false;
return false;
default:
return true;
}
}
bool QuickSettings::Refresh() {