aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-01 14:50:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 09:57:05 +0900
commit230b234891e22dd1cffd668642dc75ee023e58f5 (patch)
tree810d0380b6109c67ba89e393a70a0c021e8bce00
parentevas: Add internal API to make smart obj (un)clipped (diff)
downloadefl-230b234891e22dd1cffd668642dc75ee023e58f5.tar.gz
evas: Remove private data for clipped object
Another step towards merging both classes of smart objects.
-rw-r--r--src/lib/edje/edje_smart.c5
-rw-r--r--src/lib/evas/canvas/efl_canvas_group_clipped.eo2
-rw-r--r--src/lib/evas/canvas/evas_object_box.c3
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c8
-rw-r--r--src/lib/evas/canvas/evas_object_smart_clipped.c47
5 files changed, 36 insertions, 29 deletions
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 72452fa943..85c4a5530b 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -32,11 +32,10 @@ _edje_object_efl_object_constructor(Eo *obj, Edje *ed)
Evas *e;
void *tmp;
- ed->base = efl_data_ref(obj, EFL_CANVAS_GROUP_CLIPPED_CLASS);
- ed->duration_scale = 1.0;
-
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+ ed->base = evas_object_smart_data_get(obj);
+ ed->duration_scale = 1.0;
_edje_lib_ref();
parent = efl_parent_get(obj);
diff --git a/src/lib/evas/canvas/efl_canvas_group_clipped.eo b/src/lib/evas/canvas/efl_canvas_group_clipped.eo
index f121dce562..4a7b66eb0c 100644
--- a/src/lib/evas/canvas/efl_canvas_group_clipped.eo
+++ b/src/lib/evas/canvas/efl_canvas_group_clipped.eo
@@ -3,7 +3,7 @@
abstract Efl.Canvas.Group.Clipped (Efl.Canvas.Group)
{
[[Internal class representing a canvas object group with a clipper.]]
- data: Evas_Object_Smart_Clipped_Data;
+ data: null;
implements {
Efl.Object.constructor;
Efl.Gfx.color { set; }
diff --git a/src/lib/evas/canvas/evas_object_box.c b/src/lib/evas/canvas/evas_object_box.c
index f0d2b2a1b8..b7e021886b 100644
--- a/src/lib/evas/canvas/evas_object_box.c
+++ b/src/lib/evas/canvas/evas_object_box.c
@@ -405,9 +405,10 @@ _evas_box_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Box_Data *priv)
// make sure evas box smart data is fully initialized and set (for legacy)
// this assumes only box and smart clipped access the smart data
- cso = efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLIPPED_CLASS);
+ cso = evas_object_smart_data_get(eo_obj);
priv->base = *cso;
evas_object_smart_data_set(eo_obj, priv);
+ free(cso);
}
EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index 4b3623ef9e..c82bd47e18 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -10,8 +10,7 @@
#define MY_CLASS_NAME_LEGACY "Evas_Object_Smart"
#define EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, ...) \
- Evas_Smart_Data *o = efl_isa(eo_obj, EFL_CANVAS_GROUP_CLASS) ? \
- efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLASS) : NULL; \
+ Evas_Smart_Data *o = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_GROUP_CLASS); \
do { if (!o) { MAGIC_CHECK_FAILED(eo_obj,0,MAGIC_SMART) return __VA_ARGS__; } } while (0)
extern Eina_Hash* signals_hash_table;
@@ -37,8 +36,7 @@ struct _Evas_Smart_Data
Evas_Smart_Cb_Description_Array callbacks_descriptions;
- Evas_Coord x, y;
-
+ int x, y;
int walking_list;
int member_count; /** number of smart member objects */
@@ -1671,6 +1669,8 @@ _efl_canvas_group_group_unclipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *s
// We must call this function BEFORE the constructor (yes, it's hacky)
EINA_SAFETY_ON_FALSE_RETURN(!sd->object);
sd->unclipped = !!unclipped;
+ if (!unclipped && !sd->data)
+ sd->data = calloc(1, sizeof(Evas_Object_Smart_Clipped_Data));
}
/* Internal EO APIs */
diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c
index 2ad359716b..50fb1b0ec3 100644
--- a/src/lib/evas/canvas/evas_object_smart_clipped.c
+++ b/src/lib/evas/canvas/evas_object_smart_clipped.c
@@ -7,9 +7,7 @@
#define MY_CLASS EFL_CANVAS_GROUP_CLIPPED_CLASS
#define CSO_DATA_GET(eo_obj, ptr) \
- Evas_Object_Smart_Clipped_Data *ptr = (efl_isa(eo_obj, MY_CLASS) ? \
- efl_data_scope_get(eo_obj, MY_CLASS) : \
- evas_object_smart_data_get(eo_obj));
+ Evas_Object_Smart_Clipped_Data *ptr = evas_object_smart_data_get(eo_obj);
#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \
CSO_DATA_GET(eo_obj, ptr) \
@@ -24,14 +22,10 @@ evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
}
static void
-evas_object_smart_clipped_smart_add(Evas_Object *eo_obj)
+evas_object_smart_clipped_smart_add(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso)
{
Evas_Object *clipper;
- CSO_DATA_GET(eo_obj, cso)
- if (!cso)
- cso = calloc(1, sizeof(*cso)); /* users can provide it or realloc() later */
-
cso->evas = evas_object_evas_get(eo_obj);
clipper = evas_object_rectangle_add(cso->evas);
evas_object_static_clip_set(clipper, 1);
@@ -48,10 +42,22 @@ evas_object_smart_clipped_smart_add(Evas_Object *eo_obj)
evas_object_smart_data_set(eo_obj, cso);
}
+static void
+evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj)
+{
+ Evas_Object_Smart_Clipped_Data *cso;
+
+ cso = calloc(1, sizeof(*cso));
+ evas_object_smart_clipped_smart_add(eo_obj, cso);
+}
+
EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
+_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, void *_pd EINA_UNUSED)
{
- evas_object_smart_clipped_smart_add(eo_obj);
+ Evas_Object_Smart_Clipped_Data *cso;
+
+ cso = evas_object_smart_data_get(eo_obj);
+ evas_object_smart_clipped_smart_add(eo_obj, cso);
}
static void
@@ -76,7 +82,7 @@ evas_object_smart_clipped_smart_del(Evas_Object *eo_obj)
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
+_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, void *_pd EINA_UNUSED)
{
evas_object_smart_clipped_smart_del(eo_obj);
// group_del_called was already set to true, no need to call super here.
@@ -90,7 +96,7 @@ evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coo
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Coord x, Evas_Coord y)
+_efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y)
{
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y))
return;
@@ -115,7 +121,7 @@ evas_object_smart_clipped_smart_hide(Evas_Object *eo_obj)
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Eina_Bool vis)
+_efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool vis)
{
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
return;
@@ -127,8 +133,9 @@ _efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Smart_Clip
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *cso, Eina_Bool enable)
+_efl_canvas_group_clipped_efl_canvas_object_no_render_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool enable)
{
+ CSO_DATA_GET_OR_RETURN(eo_obj, cso);
enable = !!enable;
if (efl_canvas_object_no_render_get(eo_obj) == enable) return;
efl_canvas_object_no_render_set(efl_super(eo_obj, MY_CLASS), enable);
@@ -143,7 +150,7 @@ evas_object_smart_clipped_smart_color_set(Evas_Object *eo_obj, int r, int g, int
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_gfx_color_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, int r, int g, int b, int a)
+_efl_canvas_group_clipped_efl_gfx_color_set(Eo *eo_obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
{
evas_object_smart_clipped_smart_color_set(eo_obj, r, g, b, a);
}
@@ -163,7 +170,7 @@ evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *clip)
+_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *clip)
{
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
return;
@@ -185,7 +192,7 @@ evas_object_smart_clipped_smart_member_add(Evas_Object *eo_obj, Evas_Object *mem
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_group_group_member_add(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *member)
+_efl_canvas_group_clipped_efl_canvas_group_group_member_add(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *member)
{
efl_canvas_group_member_add(efl_super(eo_obj, MY_CLASS), member);
evas_object_smart_clipped_smart_member_add(eo_obj, member);
@@ -203,14 +210,14 @@ evas_object_smart_clipped_smart_member_del(Evas_Object *eo_obj, Evas_Object *mem
}
EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_group_group_member_del(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *member)
+_efl_canvas_group_clipped_efl_canvas_group_group_member_del(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *member)
{
evas_object_smart_clipped_smart_member_del(eo_obj, member);
efl_canvas_group_member_del(efl_super(eo_obj, MY_CLASS), member);
}
EOLIAN static Eo *
-_efl_canvas_group_clipped_efl_object_constructor(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
+_efl_canvas_group_clipped_efl_object_constructor(Eo *eo_obj, void *_pd EINA_UNUSED)
{
// Setting this flag before the parent constructor on purpose.
efl_canvas_group_unclipped_set(eo_obj, EINA_FALSE);
@@ -224,7 +231,7 @@ evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
if (!sc)
return;
- sc->add = evas_object_smart_clipped_smart_add;
+ sc->add = evas_object_smart_clipped_smart_add_legacy;
sc->del = evas_object_smart_clipped_smart_del;
sc->move = evas_object_smart_clipped_smart_move;
sc->show = evas_object_smart_clipped_smart_show;