diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index 4a87067e8..7b399a978 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -23,7 +23,6 @@ **********************/ static void style_mod_def(lv_style_t * style); static void style_mod_edit_def(lv_style_t * style); -static void lv_group_refocus(lv_group_t *g); /********************** * STATIC VARIABLES @@ -93,7 +92,7 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj) /*If the object is already in a group and focused then defocuse it*/ if(obj->group_p) { if(lv_obj_is_focused(obj)) { - lv_group_refocus(obj->group_p); + lv_group_focus_next(obj->group_p); LV_LOG_INFO("group: assign object to an other group"); } @@ -108,7 +107,7 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj) /* If the head and the tail is equal then there is only one object in the linked list. * In this case automatically activate it*/ if(lv_ll_get_head(&group->obj_ll) == next) { - lv_group_refocus(group); + lv_group_focus_next(group); } } @@ -122,16 +121,8 @@ void lv_group_remove_obj(lv_obj_t * obj) if(g == NULL) return; if(g->obj_focus == NULL) return; /*Just to be sure (Not possible if there is at least one object in the group)*/ - /*Focus on the next object*/ if(*g->obj_focus == obj) { - /*If this is the only object in the group then focus to nothing.*/ - if(lv_ll_get_head(&g->obj_ll) == g->obj_focus && lv_ll_get_tail(&g->obj_ll) == g->obj_focus) { - (*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL); - } - /*If there more objects in the group then focus to the next/prev object*/ - else { - lv_group_refocus(g); - } + lv_group_focus_next(g); } /* If the focuses object is still the same then it was the only object in the group but it will be deleted. @@ -329,17 +320,6 @@ void lv_group_set_click_focus(lv_group_t * group, bool en) group->click_focus = en ? 1 : 0; } -void lv_group_set_refocus_policy(lv_group_t * group, lv_group_refocus_policy_t policy) { - group->refocus_policy = policy & 0x01; -} - -static void lv_group_refocus(lv_group_t *g) { - if(g->refocus_policy == LV_GROUP_REFOCUS_POLICY_NEXT) - lv_group_focus_next(g); - else if(g->refocus_policy == LV_GROUP_REFOCUS_POLICY_PREV) - lv_group_focus_prev(g); -} - /** * Modify a style with the set 'style_mod' function. The input style remains unchanged. * @param group pointer to group