Clean up the different parents in the EFL.

This change was dubbed "visual parent" on my todo. Essentially what it
does is better defines eo_parent (as seen in the docs), limits the usage
(and exposure of the other parents) and renames them to more descriptive
names.

Merge branch 'devs/tasn/raw_parent'
This commit is contained in:
Tom Hacohen 2016-04-18 10:10:43 +01:00
commit 801db333bb
28 changed files with 192 additions and 43 deletions

View File

@ -254,6 +254,7 @@ tests/edje/data/test_filters.edc \
tests/edje/data/test_snapshot.edc \
tests/edje/data/test_size_class.edc \
tests/edje/data/test_color_class.edc \
tests/edje/data/test_swallows.edc \
tests/edje/data/filter.lua
@ -297,6 +298,7 @@ EDJE_TEST_FILES = tests/edje/data/test_layout.edj \
tests/edje/data/test_filters.edj \
tests/edje/data/test_snapshot.edj \
tests/edje/data/test_size_class.edj \
tests/edje/data/test_swallows.edj \
tests/edje/data/test_color_class.edj
noinst_DATA += $(EDJE_TEST_FILES)

View File

@ -1232,6 +1232,7 @@ tests_elementary_elm_suite_SOURCES = \
tests_elementary_elm_suite_CPPFLAGS = \
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests/elementary\" \
-DELM_IMAGE_DATA_DIR=\"${top_srcdir}/data/elementary\" \
-DELM_TEST_DATA_DIR=\"${abs_top_builddir}/data/elementary\" \
-I$(top_srcdir)/src/lib/elementary \
-I$(top_builddir)/src/lib/elementary \
@CHECK_CFLAGS@ \

View File

@ -315,6 +315,7 @@ _edje_real_part_free(Edje *ed, Edje_Real_Part *rp)
if ((rp->type == EDJE_RP_TYPE_SWALLOW) && (rp->typedata.swallow)
&& (rp->typedata.swallow->swallowed_object))
{
eo_parent_set(rp->typedata.swallow->swallowed_object, evas_common_evas_get(ed->obj));
evas_object_smart_member_del(rp->typedata.swallow->swallowed_object);
evas_object_event_callback_del(rp->typedata.swallow->swallowed_object,
EVAS_CALLBACK_FREE, _edje_object_part_swallow_free_cb);
@ -3147,7 +3148,11 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
evas_object_show(rp->object);
evas_object_smart_member_add(rp->object, ed->obj);
evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP)
if (ep->type == EDJE_PART_TYPE_SWALLOW)
{
eo_parent_set(rp->object, ed->obj);
}
else if (ep->type != EDJE_PART_TYPE_GROUP)
{
if (ep->mouse_events)
{

View File

@ -4966,6 +4966,7 @@ _edje_child_add(Edje *ed, Edje_Real_Part *rp, Evas_Object *child)
evas_object_event_callback_add(child, EVAS_CALLBACK_DEL, _edje_child_del_cb, rp);
evas_object_data_set(child, ".edje", ed);
if (!ed) return;
eo_parent_set(child, ed->obj);
ed->dirty = EINA_TRUE;
ed->recalc_call = EINA_TRUE;
#ifdef EDJE_CALC_CACHE
@ -4974,12 +4975,22 @@ _edje_child_add(Edje *ed, Edje_Real_Part *rp, Evas_Object *child)
_edje_recalc(ed);
}
static void
_eo_unparent_helper(Eo *child, Eo *parent)
{
if (eo_parent_get(child) == parent)
{
eo_parent_set(child, evas_common_evas_get(parent));
}
}
static void
_edje_child_remove(Edje *ed, Edje_Real_Part *rp, Evas_Object *child)
{
evas_object_event_callback_del_full(child, EVAS_CALLBACK_DEL, _edje_child_del_cb, rp);
evas_object_data_del(child, ".edje");
if (!ed) return;
_eo_unparent_helper(child, ed->obj);
ed->dirty = EINA_TRUE;
ed->recalc_call = EINA_TRUE;
#ifdef EDJE_CALC_CACHE
@ -6322,6 +6333,7 @@ _edje_real_part_swallow(Edje *ed,
#endif
if (!obj_swallow) return;
rp->typedata.swallow->swallowed_object = obj_swallow;
eo_parent_set(obj_swallow, ed->obj);
evas_object_smart_member_add(rp->typedata.swallow->swallowed_object, ed->obj);
if (rp->part->clip_to_id >= 0)
{
@ -6380,6 +6392,7 @@ _edje_real_part_swallow_clear(Edje *ed, Edje_Real_Part *rp)
if ((rp->type != EDJE_RP_TYPE_SWALLOW) ||
(!rp->typedata.swallow)) return;
if (!rp->typedata.swallow->swallowed_object) return;
_eo_unparent_helper(rp->typedata.swallow->swallowed_object, ed->obj);
evas_object_smart_member_del(rp->typedata.swallow->swallowed_object);
evas_object_event_callback_del_full(rp->typedata.swallow->swallowed_object,
EVAS_CALLBACK_DEL,

View File

@ -5,7 +5,9 @@
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
#define ELM_WIDGET_PROTECTED
#define ELM_WIDGET_ITEM_PROTECTED
#include <Elementary.h>
#include "elm_priv.h"
@ -1158,7 +1160,7 @@ _elm_ctxpopup_evas_object_smart_del(Eo *obj, Elm_Ctxpopup_Data *sd)
}
EOLIAN static void
_elm_ctxpopup_elm_widget_parent_set(Eo *obj, Elm_Ctxpopup_Data *_pd EINA_UNUSED, Evas_Object *parent)
_elm_ctxpopup_elm_widget_widget_parent_set(Eo *obj, Elm_Ctxpopup_Data *_pd EINA_UNUSED, Evas_Object *parent)
{
//default parent is to be hover parent
elm_ctxpopup_hover_parent_set(obj, parent);

View File

@ -5,6 +5,7 @@
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
#define ELM_WIDGET_PROTECTED
#define ELM_WIDGET_ITEM_PROTECTED
#include <Elementary.h>
#include "elm_priv.h"
@ -596,7 +597,7 @@ _elm_hoversel_evas_object_smart_hide(Eo *obj, Elm_Hoversel_Data *sd)
}
EOLIAN static void
_elm_hoversel_elm_widget_parent_set(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED, Evas_Object *parent)
_elm_hoversel_elm_widget_widget_parent_set(Eo *obj, Elm_Hoversel_Data *_pd EINA_UNUSED, Evas_Object *parent)
{
elm_hoversel_hover_parent_set(obj, parent);
}

View File

@ -4,6 +4,7 @@
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
#define ELM_WIDGET_PROTECTED
#define ELM_WIDGET_ITEM_PROTECTED
#include <Elementary.h>
@ -471,7 +472,7 @@ _elm_popup_elm_layout_sizing_eval(Eo *obj, Elm_Popup_Data *sd)
edje_object_message_signal_process(elm_layout_edje_get(sd->content_area));
elm_popup_align_get(obj, &horizontal, &vertical);
evas_object_geometry_get(elm_widget_parent_get(obj), NULL, NULL, &w, &h);
evas_object_geometry_get(sd->parent, NULL, NULL, &w, &h);
if (horizontal == ELM_NOTIFY_ALIGN_FILL)
minw = w;
@ -1572,7 +1573,7 @@ _parent_geom_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_i
}
EOLIAN static void
_elm_popup_elm_widget_parent_set(Eo *obj, Elm_Popup_Data *sd, Evas_Object *parent)
_elm_popup_elm_widget_widget_parent_set(Eo *obj, Elm_Popup_Data *sd, Evas_Object *parent)
{
Evas_Coord x, y, w, h;
evas_object_geometry_get(parent, &x, &y, &w, &h);

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#define ELM_WIDGET_PROTECTED
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#include <Elementary.h>
@ -954,7 +955,7 @@ _elm_conformant_evas_object_smart_del(Eo *obj, Elm_Conformant_Data *sd)
}
EOLIAN static void
_elm_conformant_elm_widget_parent_set(Eo *obj, Elm_Conformant_Data *sd, Evas_Object *parent)
_elm_conformant_elm_widget_widget_parent_set(Eo *obj, Elm_Conformant_Data *sd, Evas_Object *parent)
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top = elm_widget_top_get(parent);

View File

@ -6,7 +6,7 @@ class Elm.Conformant (Elm.Layout)
Eo.Base.constructor;
Evas.Object_Smart.add;
Evas.Object_Smart.del;
Elm.Widget.parent.set;
Elm.Widget.widget_parent.set;
Elm.Widget.theme_apply;
Elm.Layout.content_aliases.get;
}

View File

@ -203,7 +203,7 @@ class Elm.Ctxpopup (Elm.Layout, Elm.Interface_Atspi_Widget_Action, Efl.Orientati
Eo.Base.constructor;
Evas.Object_Smart.del;
Evas.Object_Smart.add;
Elm.Widget.parent.set;
Elm.Widget.widget_parent.set;
Elm.Widget.focus_direction;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.focus_next_manager_is;

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#define ELM_WIDGET_PROTECTED
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
@ -719,7 +720,7 @@ elm_hover_parent_set(Evas_Object *obj,
}
EOLIAN static void
_elm_hover_elm_widget_parent_set(Eo *obj, Elm_Hover_Data *sd, Evas_Object *parent)
_elm_hover_elm_widget_widget_parent_set(Eo *obj, Elm_Hover_Data *sd, Evas_Object *parent)
{
_elm_hover_parent_detach(obj);
@ -757,7 +758,7 @@ elm_hover_parent_get(const Evas_Object *obj)
}
EOLIAN static Evas_Object*
_elm_hover_elm_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Hover_Data *sd)
_elm_hover_elm_widget_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Hover_Data *sd)
{
return sd->parent;
}

View File

@ -66,7 +66,7 @@ class Elm.Hover (Elm.Layout, Evas.Clickable_Interface, Elm.Interface_Atspi_Widge
Evas.Object_Smart.resize;
Elm.Widget.theme_apply;
Elm.Widget.sub_object_add;
Elm.Widget.parent;
Elm.Widget.widget_parent;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.focus_next_manager_is;
Elm.Widget.sub_object_del;

View File

@ -94,7 +94,7 @@ class Elm.Hoversel (Elm.Button, Evas.Selectable_Interface,
Evas.Object_Smart.show;
Evas.Object_Smart.add;
Evas.Object_Smart.del;
Elm.Widget.parent.set;
Elm.Widget.widget_parent.set;
Elm.Widget.theme_apply;
Elm.Widget.translate;
Elm.Widget.event;

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#define ELM_WIDGET_PROTECTED
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#include <Elementary.h>
@ -79,7 +80,7 @@ _elm_inwin_evas_object_smart_add(Eo *obj, void *_pd EINA_UNUSED)
}
EOLIAN static void
_elm_inwin_elm_widget_parent_set(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *parent)
_elm_inwin_elm_widget_widget_parent_set(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *parent)
{
elm_win_resize_object_add(parent, obj);

View File

@ -21,7 +21,7 @@ class Elm.Inwin (Elm.Layout)
class.constructor;
Eo.Base.constructor;
Evas.Object_Smart.add;
Elm.Widget.parent.set;
Elm.Widget.widget_parent.set;
Elm.Widget.focus_next_manager_is;
Elm.Widget.focus_next;
Elm.Layout.content_aliases.get;

View File

@ -674,6 +674,15 @@ _elm_layout_part_aliasing_eval(const Evas_Object *obj EINA_UNUSED,
return EINA_TRUE;
}
static void
_eo_unparent_helper(Eo *child, Eo *parent)
{
if (eo_parent_get(child) == parent)
{
eo_parent_set(child, evas_common_evas_get(parent));
}
}
static void
_box_reference_del(void *data,
Evas *e EINA_UNUSED,
@ -701,6 +710,7 @@ _sub_box_remove(Evas_Object *obj,
edje_object_part_box_remove
(wd->resize_obj, sub_d->part, child);
_eo_unparent_helper(child, obj);
if (!elm_widget_sub_object_del(obj, child))
{
ERR("could not remove sub object %p from %p", child, obj);
@ -739,6 +749,8 @@ _sub_table_remove(Evas_Object *obj,
edje_object_part_table_unpack
(wd->resize_obj, sub_d->part, child);
_eo_unparent_helper(child, obj);
if (!elm_widget_sub_object_del(obj, child))
{
ERR("could not remove sub object %p from %p", child, obj);
@ -1001,6 +1013,7 @@ _elm_layout_elm_container_content_set(Eo *obj, Elm_Layout_Smart_Data *sd, const
if (!strcmp(part, sub_d->part))
{
if (content == sub_d->obj) goto end;
_eo_unparent_helper(sub_d->obj, obj);
evas_object_del(sub_d->obj);
break;
}
@ -1040,6 +1053,7 @@ _elm_layout_elm_container_content_set(Eo *obj, Elm_Layout_Smart_Data *sd, const
sub_d->obj = content;
sd->subs = eina_list_append(sd->subs, sub_d);
eo_parent_set(content, obj);
_icon_signal_emit(sd, sub_d, EINA_TRUE);
}
@ -1116,6 +1130,7 @@ _elm_layout_elm_container_content_unset(Eo *obj, Elm_Layout_Smart_Data *sd, cons
edje_object_part_unswallow
(wd->resize_obj, content);
_eo_unparent_helper(content, obj);
return content;
}
}
@ -1284,6 +1299,15 @@ _elm_layout_text_get(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part)
return edje_object_part_text_get(wd->resize_obj, part);
}
static void
_layout_box_subobj_init(Elm_Layout_Smart_Data *sd, Elm_Layout_Sub_Object_Data *sub_d, const char *part, Evas_Object *child)
{
sub_d->part = eina_stringshare_add(part);
sub_d->obj = child;
sd->subs = eina_list_append(sd->subs, sub_d);
eo_parent_set(child, sd->obj);
}
EOLIAN static Eina_Bool
_elm_layout_box_append(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Evas_Object *child)
{
@ -1314,9 +1338,7 @@ _elm_layout_box_append(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Eva
return EINA_FALSE;
}
sub_d->type = BOX_APPEND;
sub_d->part = eina_stringshare_add(part);
sub_d->obj = child;
sd->subs = eina_list_append(sd->subs, sub_d);
_layout_box_subobj_init(sd, sub_d, part, child);
elm_obj_layout_sizing_eval(obj);
@ -1353,9 +1375,7 @@ _elm_layout_box_prepend(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Ev
return EINA_FALSE;
}
sub_d->type = BOX_PREPEND;
sub_d->part = eina_stringshare_add(part);
sub_d->obj = child;
sd->subs = eina_list_prepend(sd->subs, sub_d);
_layout_box_subobj_init(sd, sub_d, part, child);
elm_obj_layout_sizing_eval(obj);
@ -1393,10 +1413,8 @@ _elm_layout_box_insert_before(Eo *obj, Elm_Layout_Smart_Data *sd, const char *pa
return EINA_FALSE;
}
sub_d->type = BOX_INSERT_BEFORE;
sub_d->part = eina_stringshare_add(part);
sub_d->obj = child;
sub_d->p.box.reference = reference;
sd->subs = eina_list_append(sd->subs, sub_d);
_layout_box_subobj_init(sd, sub_d, part, child);
evas_object_event_callback_add
((Evas_Object *)reference, EVAS_CALLBACK_DEL, _box_reference_del, sub_d);
@ -1436,10 +1454,8 @@ _elm_layout_box_insert_at(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part,
return EINA_FALSE;
}
sub_d->type = BOX_INSERT_AT;
sub_d->part = eina_stringshare_add(part);
sub_d->obj = child;
sub_d->p.box.pos = pos;
sd->subs = eina_list_append(sd->subs, sub_d);
_layout_box_subobj_init(sd, sub_d, part, child);
elm_obj_layout_sizing_eval(obj);
@ -1537,6 +1553,7 @@ _elm_layout_table_pack(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Eva
sub_d->p.table.colspan = colspan;
sub_d->p.table.rowspan = rowspan;
sd->subs = eina_list_append(sd->subs, sub_d);
eo_parent_set(child, obj);
elm_obj_layout_sizing_eval(obj);

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#define ELM_WIDGET_PROTECTED
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
@ -831,7 +832,7 @@ elm_menu_parent_set(Evas_Object *obj,
}
EOLIAN static void
_elm_menu_elm_widget_parent_set(Eo *obj, Elm_Menu_Data *sd, Evas_Object *parent)
_elm_menu_elm_widget_widget_parent_set(Eo *obj, Elm_Menu_Data *sd, Evas_Object *parent)
{
Eina_List *l, *_l, *_ll, *ll = NULL;
Elm_Object_Item *eo_item;
@ -883,7 +884,7 @@ elm_menu_parent_get(const Evas_Object *obj)
}
EOLIAN static Evas_Object*
_elm_menu_elm_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
_elm_menu_elm_widget_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Menu_Data *sd)
{
return sd->parent;
}

View File

@ -73,7 +73,7 @@ class Elm.Menu (Elm.Widget, Evas.Clickable_Interface, Elm.Interface_Atspi_Select
Evas.Object_Smart.show;
Evas.Object_Smart.add;
Evas.Object_Smart.del;
Elm.Widget.parent;
Elm.Widget.widget_parent;
Elm.Widget.theme_apply;
Elm.Widget.translate;
Elm.Interface_Atspi_Accessible.children.get;

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#define ELM_WIDGET_PROTECTED
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#include <Elementary.h>
@ -487,7 +488,7 @@ elm_notify_parent_set(Evas_Object *obj,
}
EOLIAN static void
_elm_notify_elm_widget_parent_set(Eo *obj, Elm_Notify_Data *sd, Evas_Object *parent)
_elm_notify_elm_widget_widget_parent_set(Eo *obj, Elm_Notify_Data *sd, Evas_Object *parent)
{
if (sd->parent)
{
@ -534,7 +535,7 @@ elm_notify_parent_get(const Evas_Object *obj)
}
EOLIAN static Evas_Object*
_elm_notify_elm_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
_elm_notify_elm_widget_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
{
return sd->parent;
}

View File

@ -84,7 +84,7 @@ class Elm.Notify (Elm.Container)
Evas.Object_Smart.del;
Evas.Object_Smart.resize;
Elm.Widget.focus_direction;
Elm.Widget.parent;
Elm.Widget.widget_parent;
Elm.Widget.theme_apply;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.focus_next_manager_is;

View File

@ -173,7 +173,7 @@ class Elm.Popup (Elm.Layout, Elm.Interface_Atspi_Widget_Action)
Elm.Widget.focus_direction_manager_is;
Elm.Widget.access;
Elm.Widget.focus_next;
Elm.Widget.parent.set;
Elm.Widget.widget_parent.set;
Elm.Widget.translate;
Elm.Widget.sub_object_del;
Elm.Widget.event;

View File

@ -4,6 +4,7 @@
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
#define ELM_WIDGET_PROTECTED
#define ELM_WIDGET_ITEM_PROTECTED
#include <Elementary.h>
@ -855,7 +856,7 @@ _elm_object_focus_chain_del_cb(void *data,
}
EOLIAN static void
_elm_widget_parent_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Object *parent EINA_UNUSED)
_elm_widget_widget_parent_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, Evas_Object *parent EINA_UNUSED)
{
}
@ -2913,7 +2914,7 @@ _elm_widget_focus_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool focus)
}
EOLIAN static Evas_Object*
_elm_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
_elm_widget_widget_parent_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
{
return sd->parent_obj;
}

View File

@ -206,10 +206,13 @@ abstract Elm.Widget (Evas.Object_Smart, Elm.Interface_Atspi_Accessible, Elm.Inte
highlight: bool;
}
}
@property parent {
@property widget_parent @protected {
[[The internal widget parent]]
set {
legacy: elm_widget_parent_set; /* Needed because we don't do duplication removal for legacy names. */
}
get {
legacy: elm_widget_parent_get; /* Needed because we don't do duplication removal for legacy names. */
}
values {
parent: Evas.Object * @nullable;

View File

@ -964,13 +964,20 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx.Base, Efl.Gfx.Stac
return: const(list<Evas.Object*>)* @warn_unused; [[A list of objects being clipped by $obj.]]
}
}
@property smart_parent {
@property render_parent @protected {
[[Gets the parent smart object of a given Evas object, if it has one.
This can be different from @Eo.Base.parent because this one is
used internally for rendering and the normal parent is what the
user expects to be the parent.
@since 1.18
]]
get {
[[Gets the parent smart object of a given Evas object, if it
has one.
]]
return: Evas.Object * @warn_unused; [[The parent smart object
of $obj or $null.]]
legacy: evas_object_smart_parent_get;
}
values {
parent: Evas.Object *; [[The parent smart object of $obj or $null.]]
}
}
@property size_hint_display_mode {

View File

@ -1,3 +1,5 @@
#define EVAS_OBJECT_PROTECTED
#include "evas_common_private.h"
#include "evas_private.h"
@ -2065,7 +2067,7 @@ _evas_object_is_frame_object_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_
}
EOLIAN static Evas_Object *
_evas_object_smart_parent_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
_evas_object_render_parent_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
{
if (!obj) return NULL;
return obj->smart.parent;

View File

@ -0,0 +1,23 @@
collections {
group {
name: "test_group";
parts {
part {
name: "swallow";
type: SWALLOW;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
}
rel2 {
relative: 1.0 1.0;
}
}
}
}
}
}

View File

@ -350,6 +350,37 @@ START_TEST(edje_test_color_class)
}
END_TEST
START_TEST(edje_test_swallows)
{
Evas *evas = EDJE_TEST_INIT_EVAS();
Evas_Object *ly, *o1, *o2;
ly = eo_add(EDJE_OBJECT_CLASS, evas);
fail_unless(edje_object_file_set(ly, test_layout_get("test_swallows.edj"), "test_group"));
fail_unless(edje_object_part_exists(ly, "swallow"));
o1 = eo_add(EDJE_OBJECT_CLASS, ly);
fail_if(!edje_obj_part_swallow(ly, "swallow", o1));
ck_assert_ptr_eq(eo_parent_get(o1), ly);
edje_obj_part_unswallow(ly, o1);
ck_assert_ptr_eq(eo_parent_get(o1), evas_common_evas_get(o1));
fail_if(!edje_obj_part_swallow(ly, "swallow", o1));
ck_assert_ptr_eq(eo_parent_get(o1), ly);
o2 = eo_add(EDJE_OBJECT_CLASS, ly);
fail_if(!edje_obj_part_swallow(ly, "swallow", o2));
ck_assert_ptr_eq(eo_parent_get(o2), ly);
/* o1 is deleted at this point. */
ck_assert_ptr_eq(eo_parent_get(o1), evas_common_evas_get(o1));
EDJE_TEST_FREE_EVAS();
}
END_TEST
void edje_test_edje(TCase *tc)
{
tcase_add_test(tc, edje_test_edje_init);
@ -363,4 +394,5 @@ void edje_test_edje(TCase *tc)
tcase_add_test(tc, edje_test_snapshot);
tcase_add_test(tc, edje_test_size_class);
tcase_add_test(tc, edje_test_color_class);
tcase_add_test(tc, edje_test_swallows);
}

View File

@ -24,7 +24,41 @@ START_TEST(elm_atspi_role_get)
}
END_TEST
START_TEST(elm_layout_swallows)
{
char buf[PATH_MAX];
Evas_Object *win, *ly, *bt, *bt2;
elm_init(1, NULL);
win = elm_win_add(NULL, "layout", ELM_WIN_BASIC);
ly = eo_add(ELM_LAYOUT_CLASS, win);
snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR);
elm_layout_file_set(ly, buf, "layout");
evas_object_show(ly);
bt = eo_add(ELM_BUTTON_CLASS, ly);
fail_if(!elm_obj_container_content_set(ly, "element1", bt));
ck_assert_ptr_eq(eo_parent_get(bt), ly);
bt = elm_obj_container_content_unset(ly, "element1");
ck_assert_ptr_eq(eo_parent_get(bt), evas_common_evas_get(bt));
fail_if(!elm_obj_container_content_set(ly, "element1", bt));
ck_assert_ptr_eq(eo_parent_get(bt), ly);
bt2 = eo_add(ELM_BUTTON_CLASS, ly);
fail_if(!elm_obj_container_content_set(ly, "element1", bt2));
ck_assert_ptr_eq(eo_parent_get(bt2), ly);
/* bt is deleted at this point. */
ck_assert_ptr_eq(eo_parent_get(bt), evas_common_evas_get(bt));
elm_shutdown();
}
END_TEST
void elm_test_layout(TCase *tc)
{
tcase_add_test(tc, elm_atspi_role_get);
tcase_add_test(tc, elm_layout_swallows);
}