summaryrefslogtreecommitdiff
path: root/src/DisplayApp
diff options
context:
space:
mode:
Diffstat (limited to 'src/DisplayApp')
-rw-r--r--src/DisplayApp/LittleVgl.cpp12
-rw-r--r--src/DisplayApp/LittleVgl.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/DisplayApp/LittleVgl.cpp b/src/DisplayApp/LittleVgl.cpp
index 59334931..905c00ba 100644
--- a/src/DisplayApp/LittleVgl.cpp
+++ b/src/DisplayApp/LittleVgl.cpp
@@ -27,7 +27,7 @@ bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) {
return lvgl->GetTouchPadInfo(data);
}
-LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) : lcd{lcd}, touchPanel{touchPanel} {
+LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) : lcd{lcd}, touchPanel{touchPanel}, previousClick{0,0} {
lv_init();
InitTheme();
InitDisplay();
@@ -84,9 +84,13 @@ bool LittleVgl::GetTouchPadInfo(lv_indev_data_t *ptr) {
if((previousClick.x != info.x || previousClick.y != info.y) &&
(info.gesture == Drivers::Cst816S::Gestures::SingleTap)) {
- ptr->state = LV_INDEV_STATE_PR;
- previousClick.x = ptr->point.x;
- previousClick.y = ptr->point.y;
+ // TODO For an unknown reason, the first touch is taken twice into account.
+ // 'firstTouch' is a quite'n'dirty workaound until I find a better solution
+ if(firstTouch) ptr->state = LV_INDEV_STATE_REL;
+ else ptr->state = LV_INDEV_STATE_PR;
+ firstTouch = false;
+ previousClick.x = info.x;
+ previousClick.y = info.y;
}
else {
ptr->state = LV_INDEV_STATE_REL;
diff --git a/src/DisplayApp/LittleVgl.h b/src/DisplayApp/LittleVgl.h
index e356a89c..40fb1809 100644
--- a/src/DisplayApp/LittleVgl.h
+++ b/src/DisplayApp/LittleVgl.h
@@ -92,6 +92,8 @@ namespace Pinetime {
lv_style_t win_bg;
lv_style_t win_header;
lv_style_t win_btn_pr;
+
+ bool firstTouch = true;
};
}
}