mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-21 05:51:45 +08:00
fix(indev): always assign data->point to the primary point instead of… (#8596)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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*/
|
||||
|
||||
Reference in New Issue
Block a user