forked from enlightenment/efl
widget: set the parent-child relation again, when the widget is unset
Summary:
When the widget is unset from any container, a parent of the widget
doesn't exist. So we should set its parent to the top object.
But if we just set sd->parent, the parent can not find the widget as a
child. So the container widgets set the parent-child relation when
sub object is unset.
This commit is related to 0822ad2195
.
@fix
Test Plan:
Check this issue.
https://phab.enlightenment.org/D3855
The unset widget don't added any widget as child.
So when it set scale, the widget can not reload the thmeme.
Reviewers: raster, cedric, Hermet, reutskiy.v.v
Reviewed By: Hermet, reutskiy.v.v
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3957
Conflicts:
src/lib/elementary/elm_mapbuf.c
This commit is contained in:
parent
343cd4da0e
commit
62cf70034d
|
@ -310,7 +310,7 @@ _efl_ui_box_efl_pack_unpack_all(Eo *obj, Efl_Ui_Box_Data *pd)
|
||||||
pd->delete_me = EINA_TRUE;
|
pd->delete_me = EINA_TRUE;
|
||||||
bd = evas_object_smart_data_get(wd->resize_obj);
|
bd = evas_object_smart_data_get(wd->resize_obj);
|
||||||
EINA_LIST_FOREACH(bd->children, l, opt)
|
EINA_LIST_FOREACH(bd->children, l, opt)
|
||||||
elm_widget_sub_object_del(obj, opt->obj);
|
_elm_widget_sub_object_redirect_to_top(obj, opt->obj);
|
||||||
pd->delete_me = EINA_FALSE;
|
pd->delete_me = EINA_FALSE;
|
||||||
|
|
||||||
ret = evas_object_box_remove_all(wd->resize_obj, EINA_FALSE);
|
ret = evas_object_box_remove_all(wd->resize_obj, EINA_FALSE);
|
||||||
|
@ -327,7 +327,7 @@ _efl_ui_box_efl_pack_unpack(Eo *obj, Efl_Ui_Box_Data *pd, Efl_Gfx *subobj)
|
||||||
|
|
||||||
if (evas_object_box_remove(wd->resize_obj, subobj))
|
if (evas_object_box_remove(wd->resize_obj, subobj))
|
||||||
{
|
{
|
||||||
ret = elm_widget_sub_object_del(obj, subobj);
|
ret = _elm_widget_sub_object_redirect_to_top(obj, subobj);
|
||||||
_sizing_eval(obj, pd);
|
_sizing_eval(obj, pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -834,7 +834,7 @@ _item_icon_unset(Elm_Popup_Item_Data *it)
|
||||||
Evas_Object *icon = it->icon;
|
Evas_Object *icon = it->icon;
|
||||||
|
|
||||||
if (!it->icon) return NULL;
|
if (!it->icon) return NULL;
|
||||||
elm_widget_sub_object_del(WIDGET(it), icon);
|
_elm_widget_sub_object_redirect_to_top(WIDGET(it), icon);
|
||||||
evas_object_data_del(icon, "_popup_icon_parent_item");
|
evas_object_data_del(icon, "_popup_icon_parent_item");
|
||||||
efl_content_unset(efl_part(VIEW(it), CONTENT_PART));
|
efl_content_unset(efl_part(VIEW(it), CONTENT_PART));
|
||||||
elm_layout_signal_emit(VIEW(it), "elm,state,item,icon,hidden", "elm");
|
elm_layout_signal_emit(VIEW(it), "elm,state,item,icon,hidden", "elm");
|
||||||
|
|
|
@ -536,7 +536,7 @@ _elm_box_unpack(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED, Evas_Object *subobj)
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||||
|
|
||||||
if (evas_object_box_remove(wd->resize_obj, subobj))
|
if (evas_object_box_remove(wd->resize_obj, subobj))
|
||||||
elm_widget_sub_object_del(obj, subobj);
|
_elm_widget_sub_object_redirect_to_top(obj, subobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -551,7 +551,7 @@ _elm_box_unpack_all(Eo *obj, Elm_Box_Data *pd)
|
||||||
pd->delete_me = EINA_TRUE;
|
pd->delete_me = EINA_TRUE;
|
||||||
bd = evas_object_smart_data_get(wd->resize_obj);
|
bd = evas_object_smart_data_get(wd->resize_obj);
|
||||||
EINA_LIST_FOREACH (bd->children, l, opt)
|
EINA_LIST_FOREACH (bd->children, l, opt)
|
||||||
elm_widget_sub_object_del(obj, opt->obj);
|
_elm_widget_sub_object_redirect_to_top(obj, opt->obj);
|
||||||
pd->delete_me = EINA_FALSE;
|
pd->delete_me = EINA_FALSE;
|
||||||
|
|
||||||
/* EINA_FALSE means do not delete objects */
|
/* EINA_FALSE means do not delete objects */
|
||||||
|
|
|
@ -1768,7 +1768,7 @@ _flip_content_unset(Evas_Object *obj,
|
||||||
if (!*cont) return NULL;
|
if (!*cont) return NULL;
|
||||||
|
|
||||||
content = *cont;
|
content = *cont;
|
||||||
elm_widget_sub_object_del(obj, content);
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7042,7 +7042,7 @@ _elm_genlist_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
|
||||||
|
|
||||||
EINA_LIST_FREE(it->contents, content)
|
EINA_LIST_FREE(it->contents, content)
|
||||||
{
|
{
|
||||||
elm_widget_sub_object_del(WIDGET(it), content);
|
_elm_widget_sub_object_redirect_to_top(WIDGET(it), content);
|
||||||
edje_object_part_unswallow(VIEW(it), content);
|
edje_object_part_unswallow(VIEW(it), content);
|
||||||
evas_object_hide(content);
|
evas_object_hide(content);
|
||||||
if (l) *l = eina_list_append(*l, content);
|
if (l) *l = eina_list_append(*l, content);
|
||||||
|
|
|
@ -205,7 +205,7 @@ _elm_grid_unpack(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *subobj)
|
||||||
{
|
{
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||||
|
|
||||||
elm_widget_sub_object_del(obj, subobj);
|
_elm_widget_sub_object_redirect_to_top(obj, subobj);
|
||||||
evas_object_grid_unpack(wd->resize_obj, subobj);
|
evas_object_grid_unpack(wd->resize_obj, subobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ _elm_grid_clear(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool clear)
|
||||||
{
|
{
|
||||||
chld = evas_object_grid_children_get(wd->resize_obj);
|
chld = evas_object_grid_children_get(wd->resize_obj);
|
||||||
EINA_LIST_FREE(chld, o)
|
EINA_LIST_FREE(chld, o)
|
||||||
elm_widget_sub_object_del(obj, o);
|
_elm_widget_sub_object_redirect_to_top(obj, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
evas_object_grid_clear(wd->resize_obj, clear);
|
evas_object_grid_clear(wd->resize_obj, clear);
|
||||||
|
|
|
@ -699,7 +699,7 @@ _sub_box_remove(Evas_Object *obj,
|
||||||
(wd->resize_obj, sub_d->part, child);
|
(wd->resize_obj, sub_d->part, child);
|
||||||
|
|
||||||
_eo_unparent_helper(child, obj);
|
_eo_unparent_helper(child, obj);
|
||||||
if (!elm_widget_sub_object_del(obj, child))
|
if (!_elm_widget_sub_object_redirect_to_top(obj, child))
|
||||||
{
|
{
|
||||||
ERR("could not remove sub object %p from %p", child, obj);
|
ERR("could not remove sub object %p from %p", child, obj);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -739,7 +739,7 @@ _sub_table_remove(Evas_Object *obj,
|
||||||
|
|
||||||
_eo_unparent_helper(child, obj);
|
_eo_unparent_helper(child, obj);
|
||||||
|
|
||||||
if (!elm_widget_sub_object_del(obj, child))
|
if (!_elm_widget_sub_object_redirect_to_top(obj, child))
|
||||||
{
|
{
|
||||||
ERR("could not remove sub object %p from %p", child, obj);
|
ERR("could not remove sub object %p from %p", child, obj);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1008,7 +1008,7 @@ _elm_layout_content_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Ev
|
||||||
* edje_object_part_swallow()'s behavior, then */
|
* edje_object_part_swallow()'s behavior, then */
|
||||||
else if (content == sub_d->obj)
|
else if (content == sub_d->obj)
|
||||||
{
|
{
|
||||||
elm_widget_sub_object_del(obj, content);
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,7 @@ _elm_layout_content_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Ev
|
||||||
(wd->resize_obj, part, content))
|
(wd->resize_obj, part, content))
|
||||||
{
|
{
|
||||||
ERR("could not swallow %p into part '%s'", content, part);
|
ERR("could not swallow %p into part '%s'", content, part);
|
||||||
elm_widget_sub_object_del(obj, content);
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1032,7 +1032,7 @@ _elm_layout_content_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Ev
|
||||||
{
|
{
|
||||||
ERR("failed to allocate memory!");
|
ERR("failed to allocate memory!");
|
||||||
edje_object_part_unswallow(wd->resize_obj, content);
|
edje_object_part_unswallow(wd->resize_obj, content);
|
||||||
elm_widget_sub_object_del(obj, content);
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
sub_d->type = SWALLOW;
|
sub_d->type = SWALLOW;
|
||||||
|
@ -1113,7 +1113,7 @@ _elm_layout_content_unset(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part)
|
||||||
content = sub_d->obj; /* sub_d will die in
|
content = sub_d->obj; /* sub_d will die in
|
||||||
* _elm_layout_smart_sub_object_del */
|
* _elm_layout_smart_sub_object_del */
|
||||||
|
|
||||||
if (!elm_widget_sub_object_del(obj, content))
|
if (!_elm_widget_sub_object_redirect_to_top(obj, content))
|
||||||
{
|
{
|
||||||
ERR("could not remove sub object %p from %p", content, obj);
|
ERR("could not remove sub object %p from %p", content, obj);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1153,7 +1153,7 @@ _elm_layout_efl_container_content_remove(Eo *obj, Elm_Layout_Smart_Data *sd EINA
|
||||||
{
|
{
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||||
|
|
||||||
if (!elm_widget_sub_object_del(obj, content))
|
if (!_elm_widget_sub_object_redirect_to_top(obj, content))
|
||||||
{
|
{
|
||||||
ERR("could not remove sub object %p from %p", content, obj);
|
ERR("could not remove sub object %p from %p", content, obj);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
@ -1361,7 +1361,7 @@ _elm_layout_box_append(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Eva
|
||||||
if (!sub_d)
|
if (!sub_d)
|
||||||
{
|
{
|
||||||
ERR("failed to allocate memory!");
|
ERR("failed to allocate memory!");
|
||||||
elm_widget_sub_object_del(obj, child);
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
||||||
edje_object_part_box_remove(wd->resize_obj, part, child);
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1398,7 +1398,7 @@ _elm_layout_box_prepend(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Ev
|
||||||
if (!sub_d)
|
if (!sub_d)
|
||||||
{
|
{
|
||||||
ERR("failed to allocate memory!");
|
ERR("failed to allocate memory!");
|
||||||
elm_widget_sub_object_del(obj, child);
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
||||||
edje_object_part_box_remove(wd->resize_obj, part, child);
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1436,7 +1436,7 @@ _elm_layout_box_insert_before(Eo *obj, Elm_Layout_Smart_Data *sd, const char *pa
|
||||||
if (!sub_d)
|
if (!sub_d)
|
||||||
{
|
{
|
||||||
ERR("failed to allocate memory!");
|
ERR("failed to allocate memory!");
|
||||||
elm_widget_sub_object_del(obj, child);
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
||||||
edje_object_part_box_remove(wd->resize_obj, part, child);
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1477,7 +1477,7 @@ _elm_layout_box_insert_at(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part,
|
||||||
if (!sub_d)
|
if (!sub_d)
|
||||||
{
|
{
|
||||||
ERR("failed to allocate memory!");
|
ERR("failed to allocate memory!");
|
||||||
elm_widget_sub_object_del(obj, child);
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
||||||
edje_object_part_box_remove(wd->resize_obj, part, child);
|
edje_object_part_box_remove(wd->resize_obj, part, child);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1569,7 +1569,7 @@ _elm_layout_table_pack(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Eva
|
||||||
if (!sub_d)
|
if (!sub_d)
|
||||||
{
|
{
|
||||||
ERR("failed to allocate memory!");
|
ERR("failed to allocate memory!");
|
||||||
elm_widget_sub_object_del(obj, child);
|
_elm_widget_sub_object_redirect_to_top(obj, child);
|
||||||
edje_object_part_table_unpack(wd->resize_obj, part, child);
|
edje_object_part_table_unpack(wd->resize_obj, part, child);
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ _elm_mapbuf_content_unset(Eo *obj, Elm_Mapbuf_Data *sd, const char *part)
|
||||||
if (!sd->content) return NULL;
|
if (!sd->content) return NULL;
|
||||||
|
|
||||||
content = sd->content;
|
content = sd->content;
|
||||||
elm_widget_sub_object_del(obj, content);
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
||||||
_elm_mapbuf_content_unset_internal(sd, obj, content);
|
_elm_mapbuf_content_unset_internal(sd, obj, content);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,7 +413,7 @@ _elm_notify_content_unset(Eo *obj, Elm_Notify_Data *sd, const char *part)
|
||||||
if (!sd->content) return NULL;
|
if (!sd->content) return NULL;
|
||||||
|
|
||||||
content = sd->content;
|
content = sd->content;
|
||||||
elm_widget_sub_object_del(obj, sd->content);
|
_elm_widget_sub_object_redirect_to_top(obj, sd->content);
|
||||||
edje_object_part_unswallow(sd->notify, content);
|
edje_object_part_unswallow(sd->notify, content);
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
|
|
|
@ -994,7 +994,7 @@ _elm_panel_content_unset(Eo *obj, Elm_Panel_Data *sd, const char *part)
|
||||||
|
|
||||||
evas_object_box_remove_all(sd->bx, EINA_FALSE);
|
evas_object_box_remove_all(sd->bx, EINA_FALSE);
|
||||||
if (sd->scrollable)
|
if (sd->scrollable)
|
||||||
elm_widget_sub_object_del(sd->scr_ly, sd->content);
|
_elm_widget_sub_object_redirect_to_top(sd->scr_ly, sd->content);
|
||||||
sd->content = NULL;
|
sd->content = NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -827,9 +827,9 @@ _elm_scroller_content_unset(Eo *obj, Elm_Scroller_Data *sd, const char *part)
|
||||||
|
|
||||||
ret = sd->content;
|
ret = sd->content;
|
||||||
if (sd->loop_h || sd->loop_v)
|
if (sd->loop_h || sd->loop_v)
|
||||||
elm_widget_sub_object_del(obj, sd->contents);
|
_elm_widget_sub_object_redirect_to_top(obj, sd->contents);
|
||||||
else
|
else
|
||||||
elm_widget_sub_object_del(obj, sd->content);
|
_elm_widget_sub_object_redirect_to_top(obj, sd->content);
|
||||||
elm_interface_scrollable_content_set(obj, NULL);
|
elm_interface_scrollable_content_set(obj, NULL);
|
||||||
sd->content = NULL;
|
sd->content = NULL;
|
||||||
|
|
||||||
|
|
|
@ -333,7 +333,7 @@ _elm_table_unpack(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *subobj)
|
||||||
{
|
{
|
||||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||||
|
|
||||||
elm_widget_sub_object_del(obj, subobj);
|
_elm_widget_sub_object_redirect_to_top(obj, subobj);
|
||||||
evas_object_table_unpack(wd->resize_obj, subobj);
|
evas_object_table_unpack(wd->resize_obj, subobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1755,7 +1755,7 @@ _elm_toolbar_item_elm_widget_item_part_content_unset(Eo *eo_item EINA_UNUSED, El
|
||||||
}
|
}
|
||||||
|
|
||||||
elm_layout_content_unset(VIEW(item), "elm.swallow.object");
|
elm_layout_content_unset(VIEW(item), "elm.swallow.object");
|
||||||
elm_widget_sub_object_del(obj, item->object);
|
_elm_widget_sub_object_redirect_to_top(obj, item->object);
|
||||||
o = item->object;
|
o = item->object;
|
||||||
item->object = NULL;
|
item->object = NULL;
|
||||||
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
scale = (elm_widget_scale_get(obj) * elm_config_scale_get());
|
||||||
|
@ -2572,7 +2572,7 @@ _elm_toolbar_item_icon_update(Elm_Toolbar_Item_Data *item)
|
||||||
elm_layout_content_get(VIEW(item), "elm.swallow.icon");
|
elm_layout_content_get(VIEW(item), "elm.swallow.icon");
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
elm_widget_sub_object_del(WIDGET(item), old_icon);
|
_elm_widget_sub_object_redirect_to_top(WIDGET(item), old_icon);
|
||||||
elm_layout_content_set(VIEW(item), "elm.swallow.icon", item->icon);
|
elm_layout_content_set(VIEW(item), "elm.swallow.icon", item->icon);
|
||||||
if (item->icon)
|
if (item->icon)
|
||||||
elm_layout_signal_emit(VIEW(item), "elm,state,icon,visible", "elm");
|
elm_layout_signal_emit(VIEW(item), "elm,state,icon,visible", "elm");
|
||||||
|
@ -2642,7 +2642,7 @@ _elm_toolbar_item_icon_obj_set(Evas_Object *obj,
|
||||||
(VIEW(item), "elm.swallow.icon_new");
|
(VIEW(item), "elm.swallow.icon_new");
|
||||||
if (old_icon)
|
if (old_icon)
|
||||||
{
|
{
|
||||||
elm_widget_sub_object_del(WIDGET(item), old_icon);
|
_elm_widget_sub_object_redirect_to_top(WIDGET(item), old_icon);
|
||||||
evas_object_hide(old_icon);
|
evas_object_hide(old_icon);
|
||||||
}
|
}
|
||||||
elm_layout_content_set
|
elm_layout_content_set
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ _elm_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj
|
||||||
}
|
}
|
||||||
|
|
||||||
ELM_WIDGET_DATA_GET(sobj, sdc);
|
ELM_WIDGET_DATA_GET(sobj, sdc);
|
||||||
sdc->parent_obj = elm_widget_top_get(obj);
|
sdc->parent_obj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd->resize_obj == sobj) sd->resize_obj = NULL;
|
if (sd->resize_obj == sobj) sd->resize_obj = NULL;
|
||||||
|
|
|
@ -835,6 +835,16 @@ EAPI Eina_Bool _elm_widget_item_onscreen_is(Elm_Object_Item *item);
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static inline Eina_Bool
|
||||||
|
_elm_widget_sub_object_redirect_to_top(Evas_Object *obj, Evas_Object *sobj)
|
||||||
|
{
|
||||||
|
Eina_Bool ret = elm_widget_sub_object_del(obj, sobj);
|
||||||
|
if (ret)
|
||||||
|
ret = elm_widget_sub_object_add(elm_widget_top_get(obj), sobj);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* to be used by INTERNAL classes on Elementary, so that the widgets
|
/* to be used by INTERNAL classes on Elementary, so that the widgets
|
||||||
* parsing script skips it */
|
* parsing script skips it */
|
||||||
#define ELM_INTERNAL_SMART_SUBCLASS_NEW EVAS_SMART_SUBCLASS_NEW
|
#define ELM_INTERNAL_SMART_SUBCLASS_NEW EVAS_SMART_SUBCLASS_NEW
|
||||||
|
|
Loading…
Reference in New Issue