diff --git a/radio/src/gui/colorlcd/LvglWrapper.cpp b/radio/src/gui/colorlcd/LvglWrapper.cpp index 737d345d0..10ec3772c 100644 --- a/radio/src/gui/colorlcd/LvglWrapper.cpp +++ b/radio/src/gui/colorlcd/LvglWrapper.cpp @@ -62,38 +62,54 @@ extern "C" void keyboardDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data) MainWindow::instance()->checkEvents(); } +static void copy_ts_to_indev_data(const TouchState &st, lv_indev_data_t *data) +{ +#if defined(LCD_VERTICAL_INVERT) + data->point.x = LCD_W - st.x; + data->point.y = LCD_H - st.y; +#else + data->point.x = st.x; + data->point.y = st.y; +#endif +} + +static lv_indev_data_t indev_data_backup; + +static void backup_indev_data(lv_indev_data_t* data) +{ + memcpy(&indev_data_backup, data, sizeof(lv_indev_data_t)); +} + +static void copy_indev_data_backup(lv_indev_data_t* data) +{ + memcpy(data, &indev_data_backup, sizeof(lv_indev_data_t)); +} + extern "C" void touchDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data) { #if defined(HARDWARE_TOUCH) - if(!touchPanelEventOccured()) + if(!touchPanelEventOccured()) { + copy_indev_data_backup(data); return; - + } touchOccured = true; + TouchState st = touchPanelRead(); lastState = st; // hack for now - if(st.event == TE_NONE) - return; - if(st.event == TE_DOWN || st.event == TE_SLIDE) - { -#if defined (LCD_VERTICAL_INVERT) - data->point.x = LCD_W - st.x; - data->point.y = LCD_H - st.y; -#else - data->point.x = st.x; - data->point.y = st.y; -#endif + if(st.event == TE_NONE) { + TRACE("TE_NONE"); + } else if(st.event == TE_DOWN || st.event == TE_SLIDE) { + TRACE("INDEV_STATE_PRESSED"); data->state = LV_INDEV_STATE_PRESSED; + copy_ts_to_indev_data(st, data); } else { -#if defined (LCD_VERTICAL_INVERT) - data->point.x = LCD_W - st.x; - data->point.y = LCD_H - st.y; -#else - data->point.x = st.x; - data->point.y = st.y; -#endif + TRACE("INDEV_STATE_RELEASED"); data->state = LV_INDEV_STATE_RELEASED; + copy_ts_to_indev_data(st, data); } + + backup_indev_data(data); #endif } diff --git a/radio/src/thirdparty/libopenui b/radio/src/thirdparty/libopenui index 36dfc8447..44ec2db4a 160000 --- a/radio/src/thirdparty/libopenui +++ b/radio/src/thirdparty/libopenui @@ -1 +1 @@ -Subproject commit 36dfc84476536ac4fc3211ddecc18fe4a7f80a35 +Subproject commit 44ec2db4a1902215458dd40b30185df5d3311518