mirror of
https://github.com/lvgl/lvgl.git
synced 2024-12-02 22:24:02 +08:00
fix(obj_tree): fix unintended click triggers on object deletion (#5907)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
3c8ef96213
commit
ee26f1df29
@ -484,6 +484,15 @@ static void lv_obj_delete_async_cb(void * obj)
|
||||
lv_obj_delete(obj);
|
||||
}
|
||||
|
||||
static void obj_indev_reset(lv_indev_t * indev, lv_obj_t * obj)
|
||||
{
|
||||
/*Wait for release to avoid accidentally triggering other obj to be clicked*/
|
||||
lv_indev_wait_release(indev);
|
||||
|
||||
/*Reset the input device*/
|
||||
lv_indev_reset(indev, obj);
|
||||
}
|
||||
|
||||
static void obj_delete_core(lv_obj_t * obj)
|
||||
{
|
||||
if(obj->is_deleting)
|
||||
@ -516,7 +525,7 @@ static void obj_delete_core(lv_obj_t * obj)
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(indev);
|
||||
if(indev_type == LV_INDEV_TYPE_POINTER || indev_type == LV_INDEV_TYPE_BUTTON) {
|
||||
if(indev->pointer.act_obj == obj || indev->pointer.last_obj == obj || indev->pointer.scroll_obj == obj) {
|
||||
lv_indev_reset(indev, obj);
|
||||
obj_indev_reset(indev, obj);
|
||||
}
|
||||
if(indev->pointer.last_pressed == obj) {
|
||||
indev->pointer.last_pressed = NULL;
|
||||
@ -524,7 +533,7 @@ static void obj_delete_core(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
if(indev->group == group && obj == lv_indev_get_active_obj()) {
|
||||
lv_indev_reset(indev, obj);
|
||||
obj_indev_reset(indev, obj);
|
||||
}
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
|
@ -422,6 +422,8 @@ void test_observer_arc_value(void)
|
||||
|
||||
lv_obj_update_layout(obj);
|
||||
lv_test_mouse_release();
|
||||
lv_test_indev_wait(100);
|
||||
|
||||
lv_test_mouse_move_to(65, 10);
|
||||
lv_test_mouse_press();
|
||||
lv_test_indev_wait(100);
|
||||
@ -446,9 +448,12 @@ void test_observer_slider_value(void)
|
||||
|
||||
lv_obj_update_layout(obj);
|
||||
lv_test_mouse_release();
|
||||
lv_test_indev_wait(100);
|
||||
|
||||
lv_test_mouse_move_to(65, 10);
|
||||
lv_test_mouse_press();
|
||||
lv_test_indev_wait(100);
|
||||
|
||||
lv_test_mouse_move_to(75, 10);
|
||||
lv_test_mouse_press();
|
||||
lv_test_indev_wait(100);
|
||||
|
Loading…
Reference in New Issue
Block a user