diff --git a/src/drivers/wayland/lv_wl_touch.c b/src/drivers/wayland/lv_wl_touch.c index ee18ec3ddc..2705915871 100644 --- a/src/drivers/wayland/lv_wl_touch.c +++ b/src/drivers/wayland/lv_wl_touch.c @@ -112,6 +112,15 @@ static void _lv_wayland_touch_read(lv_indev_t * drv, lv_indev_data_t * data) /* Set the gesture information, before returning to LVGL */ lv_indev_gesture_recognizers_set_data(drv, data); + + if(window->body->input.touch_event_cnt > 0) { + data->point.x = window->body->input.touches[0].point.x; + data->point.y = window->body->input.touches[0].point.y; + } + else { + data->point.x = 0; + data->point.y = 0; + } } static void touch_handle_down(void * data, struct wl_touch * wl_touch, uint32_t serial, uint32_t time, diff --git a/src/indev/lv_indev_gesture.c b/src/indev/lv_indev_gesture.c index be5d2078f0..71bdabb2db 100644 --- a/src/indev/lv_indev_gesture.c +++ b/src/indev/lv_indev_gesture.c @@ -221,20 +221,9 @@ void lv_indev_set_gesture_data(lv_indev_data_t * data, lv_indev_gesture_recogniz lv_indev_gesture_type_t type) { bool is_active; - lv_point_t cur_pnt; if(recognizer == NULL) return; - /* If there is a single contact point use its coords, - * when there are no contact points it's set to 0,0 - * - * Note: If a gesture was detected, the primary point is overwritten below - */ - - lv_indev_get_gesture_primary_point(recognizer, &cur_pnt); - data->point.x = cur_pnt.x; - data->point.y = cur_pnt.y; - data->gesture_type[type] = LV_INDEV_GESTURE_NONE; data->gesture_data[type] = NULL; @@ -251,9 +240,6 @@ void lv_indev_set_gesture_data(lv_indev_data_t * data, lv_indev_gesture_recogniz switch(recognizer->state) { case LV_INDEV_GESTURE_STATE_RECOGNIZED: - lv_indev_get_gesture_center_point(recognizer, &cur_pnt); - data->point.x = cur_pnt.x; - data->point.y = cur_pnt.y; data->gesture_type[type] = type; data->gesture_data[type] = (void *) recognizer; break; diff --git a/src/others/test/lv_test_indev_gesture.c b/src/others/test/lv_test_indev_gesture.c index ad0148195d..347b9b638a 100644 --- a/src/others/test/lv_test_indev_gesture.c +++ b/src/others/test/lv_test_indev_gesture.c @@ -112,6 +112,15 @@ static void lv_test_gesture_read_cb(lv_indev_t * indev, lv_indev_data_t * data) _state.touch_data, _state.max_touch_cnt); lv_indev_gesture_recognizers_set_data(indev, data); + if(_state.touch_data != NULL && _state.max_touch_cnt > 0) { + data->point.x = _state.touch_data[0].point.x; + data->point.y = _state.touch_data[0].point.y; + } + else { + LV_LOG_ERROR("Invalid touch data or max touch count"); + data->point.x = 0; + data->point.y = 0; + } } #endif /*LV_USE_TEST*/