diff options
Diffstat (limited to 'src/lib/elementary/efl_ui_widget.c')
-rw-r--r-- | src/lib/elementary/efl_ui_widget.c | 304 |
1 files changed, 175 insertions, 129 deletions
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 768d934fae..553de7c3aa 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -186,8 +186,6 @@ _on_sub_obj_del(void *data, const Efl_Event *event); static void _propagate_event(void *data, const Efl_Event *eo_event); static void _elm_widget_shadow_update(Efl_Ui_Widget *obj); -EFL_CALLBACKS_ARRAY_DEFINE(elm_widget_subitems_callbacks, - { EFL_EVENT_DEL, _on_sub_obj_del }); EFL_CALLBACKS_ARRAY_DEFINE(efl_subitems_callbacks, { EFL_EVENT_DEL, _on_sub_obj_del }); EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, @@ -198,27 +196,13 @@ EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, static inline void _callbacks_add(Eo *widget, void *data) { - if (_elm_widget_is(widget)) - { - efl_event_callback_array_add(widget, elm_widget_subitems_callbacks(), data); - } - else - { - efl_event_callback_array_add(widget, efl_subitems_callbacks(), data); - } + efl_event_callback_array_add(widget, efl_subitems_callbacks(), data); } static inline void _callbacks_del(Eo *widget, void *data) { - if (_elm_widget_is(widget)) - { - efl_event_callback_array_del(widget, elm_widget_subitems_callbacks(), data); - } - else - { - efl_event_callback_array_del(widget, efl_subitems_callbacks(), data); - } + efl_event_callback_array_del(widget, efl_subitems_callbacks(), data); } void @@ -525,13 +509,13 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd) { //emit signal and focus eval old and new ELM_WIDGET_DATA_GET(old_parent, old_pd); - _full_eval(old_parent, old_pd); + if (old_pd) _full_eval(old_parent, old_pd); } if (efl_isa(pd->logical.parent, EFL_UI_WIDGET_CLASS)) { ELM_WIDGET_DATA_GET(pd->logical.parent, new_pd); - _full_eval(pd->logical.parent, new_pd); + if (new_pd) _full_eval(pd->logical.parent, new_pd); } } @@ -562,8 +546,7 @@ void _elm_widget_full_eval(Eo *obj) { ELM_WIDGET_DATA_GET(obj, pd); - - _full_eval(obj, pd); + if (pd) _full_eval(obj, pd); } /** @@ -652,6 +635,7 @@ _obj_mouse_down(void *data, Evas_Object *top; ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; Evas_Event_Mouse_Down *ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; @@ -667,6 +651,7 @@ _obj_mouse_move(void *data, void *event_info) { ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; Evas_Event_Mouse_Move *ev = event_info; if (!sd->still_in) return; @@ -688,6 +673,7 @@ _obj_mouse_up(void *data, void *event_info) { ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; Evas_Event_Mouse_Up *ev = event_info; if (sd->still_in && (ev->flags == EVAS_BUTTON_NONE) && @@ -705,6 +691,7 @@ _obj_mouse_in(void *data, void *event_info EINA_UNUSED) { ELM_WIDGET_DATA_GET(data, sd); + if (!sd) return; if (sd->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN && !efl_invalidated_get(data)) elm_widget_focus_mouse_up_handle(evas_object_widget_parent_find(obj)); @@ -731,6 +718,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) { @@ -744,20 +739,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 */ @@ -848,14 +841,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; @@ -951,12 +944,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); } @@ -1094,7 +1088,7 @@ _propagate_event_legacy(Eo *parent, const Efl_Event *event, Eo *obj, Elm_Event_C ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)) { if (prev_flags != *event_flags) - efl_input_event_flags_set(event->info, *event_flags); + efl_input_event_flags_set(event->info, (Efl_Input_Flags)*event_flags); return EINA_TRUE; } @@ -1182,13 +1176,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); } @@ -1224,10 +1219,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); @@ -1275,8 +1272,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); } @@ -1434,7 +1432,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."); @@ -1468,7 +1466,7 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg if (!pd->on_create) { - if ((scale != prev_scale) || (th != prev_th) || + if (!EINA_DBL_EQ(scale, prev_scale) || (th != prev_th) || (pmirrored != mirrored)) elm_widget_theme(obj); } @@ -1500,7 +1498,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); } @@ -1508,7 +1507,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); } @@ -1517,12 +1516,14 @@ EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { Efl_Ui_Widget *parent; + Eina_Bool is_widget; EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(sobj, EFL_GFX_ENTITY_INTERFACE), EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); + is_widget = elm_widget_is(sobj); //first make sure that we unregister the sobj from the parent - if (elm_widget_is(sobj)) + if (is_widget) parent = efl_ui_widget_parent_get(sobj); else parent = evas_object_data_get(sobj, "elm-parent"); @@ -1545,7 +1546,7 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob //and if it is a widget, please set the correct parent on the widget itself //the parent set method will take care of the property syncing etc. - if (elm_widget_is(sobj)) + if (is_widget) efl_ui_widget_parent_set(sobj, obj); return EINA_TRUE; @@ -1554,13 +1555,17 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { - Evas_Object *sobj_parent; + Evas_Object *sobj_parent = NULL; + Eina_Bool is_widget; if (!sobj) return EINA_FALSE; EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); - sobj_parent = evas_object_data_del(sobj, "elm-parent"); + is_widget = _elm_widget_is(sobj); + + if (!is_widget) sobj_parent = evas_object_data_del(sobj, "elm-parent"); + if (sobj_parent && sobj_parent != obj) { static int abort_on_warn = -1; @@ -1580,8 +1585,10 @@ _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob return EINA_FALSE; } - if (_elm_widget_is(sobj)) + if (is_widget) { + if (efl_ui_widget_parent_get(sobj) != obj) + return EINA_FALSE; if (_is_focused(sobj)) { elm_widget_tree_unfocusable_set(sobj, EINA_TRUE); @@ -1713,6 +1720,51 @@ _tree_unfocusable_counter_get(Eo *widget) } /** + * Evalulate tree number. + * + * This is here to support properties which are propagating through the widget tree. If this property is set to true, + * every widget in the subtree, will also be automatically true. + * When one of the widgets in the subtree then seperatly will be set to true, the unsetting on the original widget will not unset the flag automatically in this tree. + * + * The basic idea here is: + * - The numeric number beeing bigger than 0, means that the property is true + * - The difference between the number of the parent, and the number of the object, represents the boolean flag + * (0 means that the flag is equal to the one of the parent, 1 means that if the parent is false, this child is true). + */ +static int +_calculate_tree_number(int self_counter, int parent_counter, Eina_Bool flag) +{ + int distance = self_counter - parent_counter; + + if (flag) + self_counter ++; + else + self_counter --; + + distance = self_counter - parent_counter; + + if ((distance < 0) || (distance > 1)) + { + distance = MAX(MIN(flag, 1), 0); + self_counter = parent_counter + distance; + } + + return self_counter; +} + +static void +_propagate_bool_property(Elm_Widget_Smart_Data *pd, Eina_Bool flag, void (*property_setting)(Eo *obj, Eina_Bool flag)) +{ + Efl_Ui_Widget *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)) + property_setting(subs, flag); + } +} + +/** * @internal * * This API makes the widget object and its children to be unfocusable. @@ -1730,33 +1782,21 @@ _tree_unfocusable_counter_get(Eo *widget) 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); + int old_tree_unfocusable; - if (tree_unfocusable) - pd->tree_unfocusable ++; - else - pd->tree_unfocusable --; + old_tree_unfocusable = pd->tree_unfocusable; - distance = pd->tree_unfocusable - parent_counter; + pd->tree_unfocusable = _calculate_tree_number(pd->tree_unfocusable, + (pd->parent_obj ? _tree_unfocusable_counter_get(pd->parent_obj) : 0), + tree_unfocusable); - if ((distance < 0) || (distance > 1)) + if (old_tree_unfocusable != pd->tree_unfocusable) { - distance = MAX(MIN(tree_unfocusable, 1), 0); - pd->tree_unfocusable = parent_counter + distance; + _full_eval(obj, pd); + _propagate_bool_property(pd, tree_unfocusable, elm_widget_tree_unfocusable_set); } - - EINA_LIST_FOREACH(pd->subobjs, n, subs) - { - if (efl_isa(subs, EFL_UI_WIDGET_CLASS)) - elm_widget_tree_unfocusable_set(subs, elm_widget_tree_unfocusable_get(obj)); - } - - //focus state eval on all children - _elm_widget_full_eval_children(obj, pd); } /** @@ -1794,13 +1834,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)) && @@ -2065,13 +2105,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); } @@ -2091,31 +2131,17 @@ _elm_widget_top_win_focused_get(const Evas_Object *obj) 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) - pd->disabled ++; - else - pd->disabled --; + int old_state; - distance = pd->disabled - parent_counter; - - if ((distance < 0) || (distance > 1)) - { - distance = MAX(MIN(disabled, 1), 0); - pd->disabled = parent_counter + distance; - } + old_state = pd->disabled; - EINA_LIST_FOREACH(pd->subobjs, n, subs) + pd->disabled = _calculate_tree_number(pd->disabled, (pd->parent_obj ? _disabled_counter_get(pd->parent_obj) : 0), disabled); + if (old_state != pd->disabled) { - if (efl_isa(subs, EFL_UI_WIDGET_CLASS)) - efl_ui_widget_disabled_set(subs, efl_ui_widget_disabled_get(obj)); + if (efl_finalized_get(obj)) + _full_eval(obj, pd); + _propagate_bool_property(pd, disabled, efl_ui_widget_disabled_set); } - - if (efl_finalized_get(obj)) - _elm_widget_full_eval_children(obj, pd); } EOLIAN static Eina_Bool @@ -2166,10 +2192,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)) @@ -2200,10 +2226,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)) @@ -2243,10 +2269,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)) @@ -2277,10 +2303,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)) @@ -2308,7 +2335,7 @@ EOLIAN static void _efl_ui_widget_efl_gfx_entity_scale_set(Eo *obj, Elm_Widget_Smart_Data *sd, double scale) { if (scale < 0.0) scale = 0.0; - if (sd->scale != scale) + if (!EINA_DBL_EQ(sd->scale, scale)) { sd->scale = scale; elm_widget_theme(obj); @@ -2319,9 +2346,9 @@ EOLIAN static double _efl_ui_widget_efl_gfx_entity_scale_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { // FIXME: save walking up the tree by storing/caching parent scale - if (sd->scale == 0.0) + if (EINA_DBL_EQ(sd->scale, 0.0)) { - if (sd->parent_obj && elm_widget_is(sd->parent_obj)) + if (sd->parent_obj) { return efl_gfx_entity_scale_get(sd->parent_obj); } @@ -2514,13 +2541,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); @@ -2585,7 +2613,7 @@ elm_widget_theme_get(const Evas_Object *obj) if (!sd->theme) { - if (sd->parent_obj && elm_widget_is(sd->parent_obj)) + if (sd->parent_obj) return elm_widget_theme_get(sd->parent_obj); else return NULL; } @@ -2776,7 +2804,7 @@ _efl_ui_widget_efl_object_dbg_info_get(Eo *eo_obj, Elm_Widget_Smart_Data *_pd EI #define ADD_PTR_LIST(name) \ Efl_Dbg_Info* name = EFL_DBG_INFO_LIST_APPEND(focus, ""#name""); \ - _convert(name, eina_list_iterator_new(rel->name)); + _convert(name, rel->name); ADD_PTR_LIST(top) ADD_PTR_LIST(down) @@ -2787,7 +2815,7 @@ _efl_ui_widget_efl_object_dbg_info_get(Eo *eo_obj, Elm_Widget_Smart_Data *_pd EI } - //if thats a focus manager, give useful information like the border elements + //if that's a focus manager, give useful information like the border elements if (efl_isa(eo_obj, EFL_UI_FOCUS_MANAGER_INTERFACE)) { Efl_Dbg_Info *border; @@ -2880,15 +2908,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) && @@ -3113,7 +3142,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); @@ -3123,8 +3151,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); } @@ -3142,7 +3171,7 @@ elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode) EOLIAN static Efl_Ui_Focus_Move_Policy _efl_ui_widget_focus_move_policy_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd) { - return sd->focus_move_policy; + return (Efl_Ui_Focus_Move_Policy)sd->focus_move_policy; } /** @@ -3158,7 +3187,7 @@ EOLIAN static void _efl_ui_widget_focus_move_policy_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Efl_Ui_Focus_Move_Policy policy) { if (sd->focus_move_policy == (Elm_Focus_Move_Policy)policy) return; - sd->focus_move_policy = policy; + sd->focus_move_policy = (Elm_Focus_Move_Policy)policy; } /** @@ -3192,7 +3221,8 @@ _efl_ui_widget_focus_move_policy_automatic_set(Eo *obj, Elm_Widget_Smart_Data *s if (automatic) { - efl_ui_widget_focus_move_policy_set(obj, elm_config_focus_move_policy_get()); + efl_ui_widget_focus_move_policy_set + (obj, (Efl_Ui_Focus_Move_Policy)elm_config_focus_move_policy_get()); } } } @@ -4698,8 +4728,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); @@ -4750,8 +4783,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 @@ -4804,7 +4841,8 @@ _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UN else { ELM_WIDGET_DATA_GET(parent, parent_sd); - sd->shared_win_data = parent_sd->shared_win_data; + if (parent_sd) + sd->shared_win_data = parent_sd->shared_win_data; } } else @@ -4858,6 +4896,11 @@ _efl_ui_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd) efl_weak_unref(&sd->logical.parent); sd->logical.parent = NULL; } + if (sd->children) + { + eina_array_free(sd->children); + sd->children = NULL; + } sd->on_destroy = EINA_TRUE; efl_destructor(efl_super(obj, EFL_UI_WIDGET_CLASS)); @@ -4946,12 +4989,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); @@ -5161,6 +5206,7 @@ elm_widget_on_show_region_hook_set(Eo *obj, void *data, Elm_Widget_On_Show_Regio { ELM_WIDGET_DATA_GET(obj, sd); + if (!sd) return; if ((sd->on_show_region_data == data) && (sd->on_show_region == func)) return; @@ -5210,7 +5256,7 @@ elm_widget_show_region_set(Eo *obj, Eina_Rect sr, Eina_Bool forceshow) do { parent_obj = sd->parent_obj; - if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break; + if ((!parent_obj)) break; sd = efl_data_scope_get(parent_obj, MY_CLASS); if (!sd) break; @@ -5617,7 +5663,7 @@ _efl_ui_widget_part_efl_object_destructor(Eo *obj, Elm_Part_Data *pd) } static Efl_Canvas_Layout_Part_Type -_efl_ui_widget_part_efl_canvas_layout_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) +_efl_ui_widget_part_efl_canvas_layout_part_type_provider_part_type_get(const Eo *obj EINA_UNUSED, Elm_Part_Data *pd) { Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(pd->obj, MY_CLASS); EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EFL_CANVAS_LAYOUT_PART_TYPE_NONE); @@ -5645,10 +5691,6 @@ _efl_ui_widget_part_efl_ui_property_bind_property_bind(Eo *obj, Elm_Part_Data *p return _efl_ui_property_bind(widget, obj, pd, ppd->part, key, property); } -#define EFL_UI_WIDGET_PART_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_canvas_layout_part_type_get, _efl_ui_widget_part_efl_canvas_layout_part_type_get), \ - EFL_OBJECT_OP_FUNC(efl_gfx_entity_geometry_get, _efl_ui_widget_part_efl_gfx_entity_geometry_get) - #include "efl_ui_widget_part.eo.c" /* Efl.Part end */ @@ -5854,6 +5896,7 @@ _efl_ui_model_property_bind_changed(void *data, const Efl_Event *event) const char *prop; unsigned int i; + if (!pd) return; EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it) { Efl_Ui_Property_Bound *lookup; @@ -5872,6 +5915,7 @@ _efl_ui_view_property_bind_changed(void *data, const Efl_Event *event) Eina_Stringshare *prop; unsigned int i; + if (!pd) return; EINA_ARRAY_ITER_NEXT(evt->changed_properties, i, prop, it) { Efl_Ui_Property_Bound *lookup; @@ -5905,6 +5949,7 @@ _efl_ui_widget_model_provider_model_change(void *data, const Efl_Event *event) { ELM_WIDGET_DATA_GET(data, pd); + if (!pd) return; efl_replace(&pd->properties.model, efl_ui_view_model_get(pd->properties.provider)); _efl_ui_widget_model_update(data, pd); @@ -5917,6 +5962,7 @@ _efl_ui_widget_model_provider_invalidate(void *data, const Efl_Event *event EINA { ELM_WIDGET_DATA_GET(data, pd); + if (!pd) return; efl_event_callback_array_del(pd->properties.provider, efl_ui_widget_model_provider_callbacks(), data); |