Solved: LV_EVENT_CLICKED is received while object is still pressed


I added an LV_EVENT_CLICKED to an object, but when I press it I received immediately the LV_EVENT_CLICKED event.

My LV_INDEV_TYPE_POINTER implementation looks ok as it is not generating LV_INDEV_STATE_RELEASED, so it looks the LV_EVENT_CLICKED is internally generated.

How can I fix it, to receive the LV_EVENT_CLICKED after the object is press released?

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

Code to reproduce

lv_obj_t *icon = lv_img_create( aParent );
lv_obj_add_flag( icon, LV_OBJ_FLAG_CLICKABLE );
lv_obj_add_style( icon, lv_theme_get_checkable(), LV_STATE_PRESSED );
lv_obj_add_event_cb(icon, event_clicked_cb, LV_EVENT_CLICKED, NULL);

Solved: I found that it was indeed the event generated by me,
as the s_indev_drv.read_cb is regularly called, it must be lv_indev_data_t * data->state filled all the time, since if not filled, it will be considered released.