forked from enlightenment/efl
elementary: use array instead of list for subchildren
this safes in the runtime of elm_test round about 9kb (*). Additionally, using a array here is jumping way fewer times arround in memory, as we do not need to jump from node to node in a list. Additionally, this commit replaces a few abort disabler macros with a error checking macro. (which cleans the log). *: explanation: we have round about 600 widgets in elm_test, every widget is normally refered once, every list node has 4 pointer, makes round about 9600 bytes or rougly 9 KB. So the messured savings are more or less explaining the reality. Reviewed-by: Carsten Haitzler (Rasterman) <rasterman.com> Differential Revision: https://phab.enlightenment.org/D11374
This commit is contained in:
parent
6c251b2d01
commit
090c351d38
|
@ -179,11 +179,13 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
|
|||
|
||||
if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj)))
|
||||
{
|
||||
Eina_List *l;
|
||||
Eo *subobj;
|
||||
/* user has manually triggered a smart calc and wants subobjs to also calc */
|
||||
EINA_LIST_FOREACH(wd->subobjs, l, subobj)
|
||||
efl_canvas_group_calculate(subobj);
|
||||
for (unsigned int i = 0; i < eina_array_count(wd->children); ++i)
|
||||
{
|
||||
subobj = eina_array_data_get(wd->children, i);
|
||||
efl_canvas_group_calculate(subobj);
|
||||
}
|
||||
}
|
||||
elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w,
|
||||
sd->finger_size_multiplier_y, &rest_h);
|
||||
|
@ -926,8 +928,6 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd)
|
|||
Efl_Ui_Layout_Sub_Object_Data *sub_d;
|
||||
Efl_Ui_Layout_Sub_Object_Cursor *pc;
|
||||
Edje_Signal_Data *esd;
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
Efl_Model *model;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
@ -982,15 +982,15 @@ _efl_ui_layout_base_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Layout_Data *sd)
|
|||
|
||||
/* let's make our Edje object the *last* to be processed, since it
|
||||
* may (smart) parent other sub objects here */
|
||||
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
||||
{
|
||||
if (child == wd->resize_obj)
|
||||
{
|
||||
wd->subobjs =
|
||||
eina_list_demote_list(wd->subobjs, l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned int resize_id = 0;
|
||||
if (eina_array_find(wd->children, wd->resize_obj, &resize_id))
|
||||
{
|
||||
//exchange with last
|
||||
eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1));
|
||||
eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj);
|
||||
}
|
||||
}
|
||||
|
||||
sd->destructed_is = EINA_TRUE;
|
||||
|
||||
|
|
|
@ -886,9 +886,6 @@ _efl_ui_panel_efl_object_constructor(Eo *obj, Efl_Ui_Panel_Data *_pd)
|
|||
EOLIAN static void
|
||||
_efl_ui_panel_efl_object_destructor(Eo *obj, Efl_Ui_Panel_Data *sd)
|
||||
{
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
sd->delete_me = EINA_TRUE;
|
||||
|
@ -897,15 +894,15 @@ _efl_ui_panel_efl_object_destructor(Eo *obj, Efl_Ui_Panel_Data *sd)
|
|||
|
||||
/* let's make our panel object the *last* to be processed, since it
|
||||
* may (smart) parent other sub objects here */
|
||||
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
||||
{
|
||||
if (child == sd->bx)
|
||||
{
|
||||
wd->subobjs =
|
||||
eina_list_demote_list(wd->subobjs, l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned int resize_id = 0;
|
||||
if (eina_array_find(wd->children, wd->resize_obj, &resize_id))
|
||||
{
|
||||
//exchange with last
|
||||
eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1));
|
||||
eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj);
|
||||
}
|
||||
}
|
||||
|
||||
efl_destructor(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
|
|
@ -734,6 +734,14 @@ _efl_ui_widget_efl_canvas_group_group_add(Eo *obj, Elm_Widget_Smart_Data *priv)
|
|||
_obj_mouse_in, obj);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_keep(void *data, void *gdata)
|
||||
{
|
||||
if (data == gdata)
|
||||
return EINA_FALSE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_widget_efl_canvas_group_group_del(Eo *obj, Elm_Widget_Smart_Data *sd)
|
||||
{
|
||||
|
@ -747,20 +755,18 @@ _efl_ui_widget_efl_canvas_group_group_del(Eo *obj, Elm_Widget_Smart_Data *sd)
|
|||
_callbacks_del(sd->hover_obj, obj);
|
||||
sd->hover_obj = NULL;
|
||||
}
|
||||
|
||||
while (sd->subobjs)
|
||||
while(eina_array_count(sd->children))
|
||||
{
|
||||
sobj = eina_list_data_get(sd->subobjs);
|
||||
sobj = eina_array_data_get(sd->children, 0);
|
||||
|
||||
/* let the objects clean-up themselves and get rid of this list */
|
||||
if (!elm_widget_sub_object_del(obj, sobj))
|
||||
{
|
||||
ERR("failed to remove sub object %p from %p\n", sobj, obj);
|
||||
sd->subobjs = eina_list_remove_list
|
||||
(sd->subobjs, sd->subobjs);
|
||||
eina_array_remove(sd->children, _keep, sobj);
|
||||
}
|
||||
// FIXME: is that a legacy or a new object ?
|
||||
evas_object_del(sobj);
|
||||
EINA_SAFETY_ON_TRUE_RETURN(eina_array_count(sd->children) && sobj == eina_array_data_get(sd->children, 0));
|
||||
}
|
||||
sd->tooltips = eina_list_free(sd->tooltips); /* should be empty anyway */
|
||||
sd->cursors = eina_list_free(sd->cursors); /* should be empty anyway */
|
||||
|
@ -851,14 +857,14 @@ _efl_ui_widget_efl_gfx_entity_size_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Dat
|
|||
void
|
||||
_elm_widget_full_eval_children(Eo *obj, Elm_Widget_Smart_Data *sd)
|
||||
{
|
||||
Eina_List *l;
|
||||
Eo *child;
|
||||
|
||||
_full_eval(obj, sd);
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs , l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
Elm_Widget_Smart_Data *sd_child;
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
|
||||
if (!efl_isa(child, EFL_UI_WIDGET_CLASS)) continue;
|
||||
|
||||
|
@ -954,12 +960,13 @@ EOLIAN static void
|
|||
_efl_ui_widget_efl_canvas_object_is_frame_object_set(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool frame)
|
||||
{
|
||||
Evas_Object *o;
|
||||
Eina_List *li;
|
||||
|
||||
frame = !!frame;
|
||||
efl_canvas_object_is_frame_object_set(efl_super(obj, MY_CLASS), frame);
|
||||
EINA_LIST_FOREACH(pd->subobjs, li, o)
|
||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||
{
|
||||
o = eina_array_data_get(pd->children, i);
|
||||
|
||||
if (evas_object_data_get(o, "_elm_leaveme")) continue;
|
||||
efl_canvas_object_is_frame_object_set(o, frame);
|
||||
}
|
||||
|
@ -1185,13 +1192,14 @@ EAPI Eina_Bool
|
|||
elm_widget_access(Evas_Object *obj,
|
||||
Eina_Bool is_access)
|
||||
{
|
||||
const Eina_List *l;
|
||||
Evas_Object *child;
|
||||
Eina_Bool ret = EINA_TRUE;
|
||||
|
||||
API_ENTRY return EINA_FALSE;
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
|
||||
if (elm_widget_is(child))
|
||||
ret &= elm_widget_access(child, is_access);
|
||||
}
|
||||
|
@ -1227,10 +1235,12 @@ elm_widget_theme(Evas_Object *obj)
|
|||
Eina_Bool err_generic = EINA_FALSE;
|
||||
|
||||
API_ENTRY return EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
if (_elm_widget_is(child))
|
||||
_elm_widget_theme_helper(elm_widget_theme(child), &err_default, &err_generic);
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (_elm_widget_is(child))
|
||||
_elm_widget_theme_helper(elm_widget_theme(child), &err_default, &err_generic);
|
||||
}
|
||||
|
||||
if (sd->hover_obj)
|
||||
_elm_widget_theme_helper(elm_widget_theme(sd->hover_obj), &err_default, &err_generic);
|
||||
|
@ -1278,8 +1288,9 @@ elm_widget_theme_specific(Evas_Object *obj,
|
|||
}
|
||||
}
|
||||
if (!force) return;
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child))
|
||||
elm_widget_theme_specific(child, th, force);
|
||||
}
|
||||
|
@ -1437,7 +1448,7 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
|
|||
if (parent)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd);
|
||||
EINA_SAFETY_ON_FALSE_RETURN(eina_list_data_find(ppd->subobjs, obj));
|
||||
EINA_SAFETY_ON_FALSE_RETURN(eina_array_find(ppd->children, obj, NULL));
|
||||
if (ppd->parent_obj == parent)
|
||||
{
|
||||
CRI("ATTEMPTING TO SET CHILD OF PARENT AS PARENT OF ITS OWN PARENT. THIS IS A BUG.");
|
||||
|
@ -1503,7 +1514,8 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
|
|||
static void
|
||||
_widget_add_sub(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj)
|
||||
{
|
||||
sd->subobjs = eina_list_append(sd->subobjs, sobj);
|
||||
if (!sd->children) sd->children = eina_array_new(1);
|
||||
eina_array_push(sd->children, sobj);
|
||||
evas_object_data_set(sobj, "elm-parent", obj);
|
||||
_callbacks_add(sobj, obj);
|
||||
}
|
||||
|
@ -1511,7 +1523,7 @@ _widget_add_sub(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj)
|
|||
static void
|
||||
_widget_del_sub(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj)
|
||||
{
|
||||
sd->subobjs = eina_list_remove(sd->subobjs, sobj);
|
||||
eina_array_remove(sd->children, _keep, sobj);
|
||||
evas_object_data_del(sobj, "elm-parent");
|
||||
_callbacks_del(sobj, obj);
|
||||
}
|
||||
|
@ -1734,7 +1746,6 @@ EAPI void
|
|||
elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable)
|
||||
{
|
||||
Efl_Ui_Widget *subs;
|
||||
Eina_List *n;
|
||||
Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||
EINA_SAFETY_ON_NULL_RETURN(pd);
|
||||
int distance, parent_counter = (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0);
|
||||
|
@ -1751,9 +1762,9 @@ elm_widget_tree_unfocusable_set(Eo *obj, Eina_Bool tree_unfocusable)
|
|||
distance = MAX(MIN(tree_unfocusable, 1), 0);
|
||||
pd->tree_unfocusable = parent_counter + distance;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(pd->subobjs, n, subs)
|
||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||
{
|
||||
subs = eina_array_data_get(pd->children, i);
|
||||
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
|
||||
elm_widget_tree_unfocusable_set(subs, elm_widget_tree_unfocusable_get(obj));
|
||||
}
|
||||
|
@ -1797,13 +1808,13 @@ EAPI Eina_List*
|
|||
elm_widget_can_focus_child_list_get(const Eo *obj)
|
||||
{
|
||||
Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||
const Eina_List *l;
|
||||
Eina_List *child_list = NULL;
|
||||
Evas_Object *child;
|
||||
|
||||
if (!sd) return NULL;
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (!_elm_widget_is(child)) continue;
|
||||
if ((elm_widget_can_focus_get(child)) &&
|
||||
(evas_object_visible_get(child)) &&
|
||||
|
@ -2068,13 +2079,13 @@ void
|
|||
_elm_widget_top_win_focused_set(Evas_Object *obj,
|
||||
Eina_Bool top_win_focused)
|
||||
{
|
||||
const Eina_List *l;
|
||||
Evas_Object *child;
|
||||
API_ENTRY return;
|
||||
|
||||
if (sd->top_win_focused == top_win_focused) return;
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child))
|
||||
_elm_widget_top_win_focused_set(child, top_win_focused);
|
||||
}
|
||||
|
@ -2095,7 +2106,6 @@ EOLIAN static void
|
|||
_efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool disabled)
|
||||
{
|
||||
Efl_Ui_Widget *subs;
|
||||
Eina_List *n;
|
||||
int distance, parent_counter = (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0);
|
||||
|
||||
if (disabled)
|
||||
|
@ -2110,9 +2120,9 @@ _efl_ui_widget_disabled_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina
|
|||
distance = MAX(MIN(disabled, 1), 0);
|
||||
pd->disabled = parent_counter + distance;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(pd->subobjs, n, subs)
|
||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||
{
|
||||
subs = eina_array_data_get(pd->children, i);
|
||||
if (efl_isa(subs, EFL_UI_WIDGET_CLASS))
|
||||
efl_ui_widget_disabled_set(subs, efl_ui_widget_disabled_get(obj));
|
||||
}
|
||||
|
@ -2169,10 +2179,10 @@ _efl_ui_widget_scroll_hold_push(Eo *obj, Elm_Widget_Smart_Data *sd)
|
|||
else
|
||||
{
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child) && _elm_scrollable_is(child))
|
||||
{
|
||||
if (elm_widget_is_legacy(child))
|
||||
|
@ -2203,10 +2213,10 @@ _efl_ui_widget_scroll_hold_pop(Eo *obj, Elm_Widget_Smart_Data *sd)
|
|||
else
|
||||
{
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child) && _elm_scrollable_is(child))
|
||||
{
|
||||
if (elm_widget_is_legacy(child))
|
||||
|
@ -2246,10 +2256,10 @@ _efl_ui_widget_scroll_freeze_push(Eo *obj, Elm_Widget_Smart_Data *sd)
|
|||
else
|
||||
{
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child) && _elm_scrollable_is(child))
|
||||
{
|
||||
if (elm_widget_is_legacy(child))
|
||||
|
@ -2280,10 +2290,11 @@ _efl_ui_widget_scroll_freeze_pop(Eo *obj, Elm_Widget_Smart_Data *sd)
|
|||
else
|
||||
{
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
|
||||
if (elm_widget_is(child) && _elm_scrollable_is(child))
|
||||
{
|
||||
if (elm_widget_is_legacy(child))
|
||||
|
@ -2517,13 +2528,14 @@ elm_widget_part_translatable_text_get(const Eo *obj, const char *part, const cha
|
|||
EOLIAN static void
|
||||
_efl_ui_widget_efl_ui_l10n_translation_update(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
|
||||
{
|
||||
const Eina_List *l;
|
||||
Evas_Object *child;
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child))
|
||||
efl_ui_l10n_translation_update(child);
|
||||
|
||||
}
|
||||
|
||||
if (sd->hover_obj) efl_ui_l10n_translation_update(sd->hover_obj);
|
||||
|
@ -2883,15 +2895,16 @@ elm_widget_type_check(const Evas_Object *obj,
|
|||
EAPI Evas_Object *
|
||||
elm_widget_name_find(const Eo *obj, const char *name, int recurse)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *child;
|
||||
const char *s;
|
||||
INTERNAL_ENTRY NULL;
|
||||
|
||||
if (!name) return NULL;
|
||||
if (!_elm_widget_is(obj)) return NULL;
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
s = evas_object_name_get(child);
|
||||
if ((s) && (!strcmp(s, name))) return child;
|
||||
if ((recurse != 0) &&
|
||||
|
@ -3116,7 +3129,6 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode)
|
|||
{
|
||||
Evas_Display_Mode prev_dispmode;
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
API_ENTRY return;
|
||||
prev_dispmode = evas_object_size_hint_display_mode_get(obj);
|
||||
|
@ -3126,8 +3138,9 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode)
|
|||
|
||||
evas_object_size_hint_display_mode_set(obj, dispmode);
|
||||
|
||||
EINA_LIST_FOREACH (sd->subobjs, l, child)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(sd->children, i);
|
||||
if (elm_widget_is(child))
|
||||
elm_widget_display_mode_set(child, dispmode);
|
||||
}
|
||||
|
@ -4701,8 +4714,11 @@ _sub_obj_tree_dump(const Evas_Object *obj,
|
|||
DBG("+ %s(%p)\n",
|
||||
elm_widget_type_get(obj),
|
||||
obj);
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, obj)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
obj = eina_array_data_get(sd->children, i);
|
||||
_sub_obj_tree_dump(obj, lvl + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
DBG("+ %s(%p)\n", evas_object_type_get(obj), obj);
|
||||
|
@ -4753,8 +4769,12 @@ _sub_obj_tree_dot_dump(const Evas_Object *obj,
|
|||
|
||||
Eina_List *l;
|
||||
Evas_Object *o;
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, o)
|
||||
_sub_obj_tree_dot_dump(o, output);
|
||||
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
o = eina_array_data_get(sd->children, i);
|
||||
_sub_obj_tree_dot_dump(o, output);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -4950,12 +4970,14 @@ _efl_ui_widget_efl_access_object_i18n_name_get(const Eo *obj, Elm_Widget_Smart_D
|
|||
EOLIAN static Eina_List*
|
||||
_efl_ui_widget_efl_access_object_access_children_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd)
|
||||
{
|
||||
Eina_List *l, *accs = NULL;
|
||||
Eina_List *accs = NULL;
|
||||
Evas_Object *widget;
|
||||
Efl_Access_Type type;
|
||||
|
||||
EINA_LIST_FOREACH(pd->subobjs, l, widget)
|
||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||
{
|
||||
widget = eina_array_data_get(pd->children, i);
|
||||
|
||||
if (!elm_object_widget_check(widget)) continue;
|
||||
if (!efl_isa(widget, EFL_ACCESS_OBJECT_MIXIN)) continue;
|
||||
type = efl_access_object_access_type_get(widget);
|
||||
|
|
|
@ -61,13 +61,14 @@ static Efl_Ui_Widget*
|
|||
_next_widget(Efl_Gfx_Entity* o)
|
||||
{
|
||||
Efl_Ui_Widget *parent;
|
||||
Eina_List *rel;
|
||||
|
||||
parent = _fetch_parent_widget(o);
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(parent, pd, NULL);
|
||||
rel = eina_list_data_find_list(pd->subobjs, o);
|
||||
|
||||
return eina_list_data_get(eina_list_next(rel));
|
||||
unsigned int id;
|
||||
if (eina_array_find(pd->children, o, &id) && id + 1 < eina_array_count(pd->children))
|
||||
return eina_array_data_get(pd->children, id + 1);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -90,9 +91,9 @@ _widget_next(Widget_Iterator *it, void **data)
|
|||
}
|
||||
|
||||
//If there is a child, go there
|
||||
if (pd && pd->subobjs)
|
||||
if (pd && eina_array_count(pd->children))
|
||||
{
|
||||
it->current = eina_list_data_get(pd->subobjs);
|
||||
it->current = eina_array_data_get(pd->children, 0);
|
||||
goto deliver;
|
||||
}
|
||||
|
||||
|
|
|
@ -337,9 +337,6 @@ _elm_box_efl_canvas_group_group_add(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
|
|||
EOLIAN static void
|
||||
_elm_box_efl_canvas_group_group_del(Eo *obj, Elm_Box_Data *sd)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *child;
|
||||
|
||||
sd->delete_me = EINA_TRUE;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
@ -349,15 +346,15 @@ _elm_box_efl_canvas_group_group_del(Eo *obj, Elm_Box_Data *sd)
|
|||
|
||||
/* let's make our box object the *last* to be processed, since it
|
||||
* may (smart) parent other sub objects here */
|
||||
EINA_LIST_FOREACH (wd->subobjs, l, child)
|
||||
{
|
||||
if (child == wd->resize_obj)
|
||||
{
|
||||
wd->subobjs =
|
||||
eina_list_demote_list(wd->subobjs, l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned int resize_id = 0;
|
||||
if (eina_array_find(wd->children, wd->resize_obj, &resize_id))
|
||||
{
|
||||
//exchange with last
|
||||
eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1));
|
||||
eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj);
|
||||
}
|
||||
}
|
||||
|
||||
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
|
|
@ -3521,7 +3521,6 @@ _efl_ui_widget_config_reload(Efl_Ui_Widget *obj)
|
|||
Elm_Focus_Move_Policy focus_move_policy = elm_config_focus_move_policy_get();
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, sd);
|
||||
Efl_Ui_Widget *w;
|
||||
Eina_List *n;
|
||||
|
||||
//reload focus move policy
|
||||
if (efl_ui_widget_focus_move_policy_automatic_get(obj) &&
|
||||
|
@ -3530,8 +3529,9 @@ _efl_ui_widget_config_reload(Efl_Ui_Widget *obj)
|
|||
sd->focus_move_policy = focus_move_policy;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(sd->subobjs, n, w)
|
||||
for (unsigned int i = 0; i < eina_array_count(sd->children); ++i)
|
||||
{
|
||||
w = eina_array_data_get(sd->children, i);
|
||||
if (efl_isa(w, EFL_UI_WIDGET_CLASS))
|
||||
_efl_ui_widget_config_reload(w);
|
||||
}
|
||||
|
|
|
@ -51,12 +51,18 @@ _flush_manager(Efl_Ui_Widget *obj, Elm_Widget_Smart_Data *pd)
|
|||
manager = efl_ui_focus_object_focus_manager_get(obj);
|
||||
if (manager)
|
||||
{
|
||||
Eina_List *order;
|
||||
Eina_List *order = NULL;
|
||||
|
||||
if (pd->legacy_focus.custom_chain)
|
||||
order = eina_list_clone(pd->legacy_focus.custom_chain);
|
||||
else
|
||||
order = eina_list_clone(pd->subobjs);
|
||||
{
|
||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||
{
|
||||
Eo *sobj = eina_array_data_get(pd->children, i);
|
||||
order = eina_list_append(order, sobj);
|
||||
}
|
||||
}
|
||||
|
||||
efl_ui_focus_manager_calc_update_order(manager, obj, order);
|
||||
}
|
||||
|
|
|
@ -372,7 +372,6 @@ static void
|
|||
_widget_calculate_recursive(Eo *obj)
|
||||
{
|
||||
Elm_Widget_Smart_Data *pd = NULL;
|
||||
Eina_List *l;
|
||||
Evas_Object *child;
|
||||
|
||||
if (!efl_isa(obj, EFL_UI_WIDGET_CLASS)) return;
|
||||
|
@ -388,8 +387,11 @@ _widget_calculate_recursive(Eo *obj)
|
|||
return;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(pd->subobjs, l, child)
|
||||
_widget_calculate_recursive(child);
|
||||
for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
|
||||
{
|
||||
child = eina_array_data_get(pd->children, i);
|
||||
_widget_calculate_recursive(child);
|
||||
}
|
||||
|
||||
efl_canvas_group_calculate(obj);
|
||||
}
|
||||
|
|
|
@ -73,22 +73,19 @@ _elm_grid_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED)
|
|||
EOLIAN static void
|
||||
_elm_grid_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *child;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
/* let's make our grid object the *last* to be processed, since it
|
||||
* may (smart) parent other sub objects here */
|
||||
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
||||
{
|
||||
if (child == wd->resize_obj)
|
||||
{
|
||||
wd->subobjs =
|
||||
eina_list_demote_list(wd->subobjs, l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned int resize_id = 0;
|
||||
if (eina_array_find(wd->children, wd->resize_obj, &resize_id))
|
||||
{
|
||||
//exchange with last
|
||||
eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1));
|
||||
eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj);
|
||||
}
|
||||
}
|
||||
|
||||
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
|
|
@ -868,9 +868,6 @@ _elm_panel_efl_canvas_group_group_add(Eo *obj, Elm_Panel_Data *priv)
|
|||
EOLIAN static void
|
||||
_elm_panel_efl_canvas_group_group_del(Eo *obj, Elm_Panel_Data *sd)
|
||||
{
|
||||
Evas_Object *child;
|
||||
Eina_List *l;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
sd->delete_me = EINA_TRUE;
|
||||
|
@ -879,15 +876,15 @@ _elm_panel_efl_canvas_group_group_del(Eo *obj, Elm_Panel_Data *sd)
|
|||
|
||||
/* let's make our panel object the *last* to be processed, since it
|
||||
* may (smart) parent other sub objects here */
|
||||
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
||||
{
|
||||
if (child == sd->bx)
|
||||
{
|
||||
wd->subobjs =
|
||||
eina_list_demote_list(wd->subobjs, l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned int resize_id = 0;
|
||||
if (eina_array_find(wd->children, wd->resize_obj, &resize_id))
|
||||
{
|
||||
//exchange with last
|
||||
eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1));
|
||||
eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj);
|
||||
}
|
||||
}
|
||||
|
||||
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
|
|
@ -109,9 +109,6 @@ _elm_table_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED)
|
|||
EOLIAN static void
|
||||
_elm_table_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *child;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
evas_object_event_callback_del_full
|
||||
|
@ -120,15 +117,15 @@ _elm_table_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED)
|
|||
|
||||
/* let's make our table object the *last* to be processed, since it
|
||||
* may (smart) parent other sub objects here */
|
||||
EINA_LIST_FOREACH(wd->subobjs, l, child)
|
||||
{
|
||||
if (child == wd->resize_obj)
|
||||
{
|
||||
wd->subobjs =
|
||||
eina_list_demote_list(wd->subobjs, l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned int resize_id = 0;
|
||||
if (eina_array_find(wd->children, wd->resize_obj, &resize_id))
|
||||
{
|
||||
//exchange with last
|
||||
eina_array_data_set(wd->children, resize_id, eina_array_data_get(wd->children, eina_array_count(wd->children) - 1));
|
||||
eina_array_data_set(wd->children, eina_array_count(wd->children) - 1, wd->resize_obj);
|
||||
}
|
||||
}
|
||||
|
||||
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ typedef void (*Elm_Widget_On_Show_Region_Cb)(void *data, Evas_Object *obj, Eina_
|
|||
typedef struct _Elm_Widget_Smart_Data
|
||||
{
|
||||
Evas_Object *parent_obj; /**< parent object of a widget in the elementary tree */
|
||||
Eina_List *subobjs; /**< list of widgets' sub objects in the elementary tree */
|
||||
Eina_Array *children;
|
||||
Evas_Object *resize_obj; /**< an unique object for each widget that shows the look of a widget. Resize object's geometry is same as the widget. This resize object is different from that of window's resize object. */
|
||||
Evas_Object *hover_obj;
|
||||
Evas_Object *bg;
|
||||
|
|
|
@ -93,7 +93,7 @@ resize_object(Efl_Canvas_Object *o)
|
|||
{
|
||||
Efl_Ui_Widget_Data *pd = efl_data_scope_safe_get(o, EFL_UI_WIDGET_CLASS);
|
||||
|
||||
return eina_list_data_get(pd->subobjs);
|
||||
return eina_array_data_get(pd->children, 0);
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_ui_test_widget_widget_sub_iterator)
|
||||
|
@ -182,16 +182,16 @@ EFL_START_TEST(efl_ui_test_widget_sub_object_add_del)
|
|||
State s;
|
||||
|
||||
_small_ui(&s);
|
||||
DISABLE_ABORT_ON_CRITICAL_START;
|
||||
EXPECT_ERROR_START;
|
||||
ck_assert(!efl_ui_widget_sub_object_add(s.btn1, s.btn1));
|
||||
DISABLE_ABORT_ON_CRITICAL_END;
|
||||
EXPECT_ERROR_END;
|
||||
ck_assert(efl_ui_widget_sub_object_add(s.box, s.btn1));
|
||||
DISABLE_ABORT_ON_CRITICAL_START;
|
||||
EXPECT_ERROR_START;
|
||||
ck_assert(!efl_ui_widget_sub_object_add(s.box, NULL));
|
||||
ck_assert(!efl_ui_widget_sub_object_del(s.btn1, s.btn1));
|
||||
ck_assert(!efl_ui_widget_sub_object_del(s.box, NULL));
|
||||
ck_assert(!efl_ui_widget_sub_object_del(s.btn1, s.box));
|
||||
DISABLE_ABORT_ON_CRITICAL_END;
|
||||
EXPECT_ERROR_END;
|
||||
ck_assert(efl_ui_widget_sub_object_del(s.box, s.btn1));
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
|
Loading…
Reference in New Issue