mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
lv_list: check the return value of btn events
This commit is contained in:
parent
6a3c7d2b95
commit
6284e3a21b
@ -345,9 +345,10 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
/*Delete from the group*/
|
||||
#if LV_USE_GROUP
|
||||
bool was_focused = false;
|
||||
lv_group_t * group = lv_obj_get_group(obj);
|
||||
|
||||
if(obj->group_p) {
|
||||
if(lv_group_get_focused(obj->group_p) == obj) was_focused = true;
|
||||
if(group) {
|
||||
if(lv_group_get_focused(group) == obj) was_focused = true;
|
||||
lv_group_remove_obj(obj);
|
||||
}
|
||||
#endif
|
||||
@ -390,7 +391,7 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
if(was_focused) {
|
||||
if(indev->group == group && was_focused) {
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
#endif
|
||||
@ -2067,8 +2068,9 @@ static void delete_children(lv_obj_t * obj)
|
||||
* LV_SIGNAL_DEFOCUS call*/
|
||||
#if LV_USE_GROUP
|
||||
bool was_focused = false;
|
||||
lv_group_t * group = lv_obj_get_group(obj);
|
||||
|
||||
if(obj->group_p) {
|
||||
if(group) {
|
||||
if(lv_group_get_focused(obj->group_p) == obj) was_focused = true;
|
||||
lv_group_remove_obj(obj);
|
||||
}
|
||||
@ -2098,7 +2100,7 @@ static void delete_children(lv_obj_t * obj)
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
#if LV_USE_GROUP
|
||||
if(was_focused) {
|
||||
if(indev->group == group && was_focused) {
|
||||
lv_indev_reset(indev);
|
||||
}
|
||||
#endif
|
||||
|
@ -18,8 +18,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_MEM_ADD_JUNK \
|
||||
0 /*Add memory junk on alloc (0xaa) and free(0xbb) (just for testing purposes)*/
|
||||
/*Add memory junk on alloc (0xaa) and free(0xbb) (just for testing purposes)*/
|
||||
#define LV_MEM_ADD_JUNK 0
|
||||
|
||||
#ifdef LV_MEM_ENV64
|
||||
#define MEM_UNIT uint64_t
|
||||
|
@ -745,20 +745,24 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
* button*/
|
||||
if(btn) {
|
||||
if(sign == LV_SIGNAL_PRESSED) {
|
||||
lv_event_send(btn, LV_EVENT_PRESSED, NULL);
|
||||
res = lv_event_send(btn, LV_EVENT_PRESSED, NULL);
|
||||
} else if(sign == LV_SIGNAL_PRESSING) {
|
||||
lv_event_send(btn, LV_EVENT_PRESSING, NULL);
|
||||
res = lv_event_send(btn, LV_EVENT_PRESSING, NULL);
|
||||
} else if(sign == LV_SIGNAL_LONG_PRESS) {
|
||||
lv_event_send(btn, LV_EVENT_LONG_PRESSED, NULL);
|
||||
res = lv_event_send(btn, LV_EVENT_LONG_PRESSED, NULL);
|
||||
} else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||
lv_event_send(btn, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||
res = lv_event_send(btn, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
|
||||
} else if(sign == LV_SIGNAL_RELEASED) {
|
||||
ext->last_sel = btn;
|
||||
if(indev->proc.long_pr_sent == 0)
|
||||
lv_event_send(btn, LV_EVENT_SHORT_CLICKED, NULL);
|
||||
if(lv_indev_is_dragging(indev) == false)
|
||||
lv_event_send(btn, LV_EVENT_CLICKED, NULL);
|
||||
lv_event_send(btn, LV_EVENT_RELEASED, NULL);
|
||||
if(indev->proc.long_pr_sent == 0) {
|
||||
res = lv_event_send(btn, LV_EVENT_SHORT_CLICKED, NULL);
|
||||
}
|
||||
if(lv_indev_is_dragging(indev) == false && res == LV_RES_OK) {
|
||||
res = lv_event_send(btn, LV_EVENT_CLICKED, NULL);
|
||||
}
|
||||
if(res == LV_RES_OK) {
|
||||
res = lv_event_send(btn, LV_EVENT_RELEASED, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user