aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-01 15:35:33 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-13 09:57:05 +0900
commit67798ca8636c362d947f33bb793ab9480d0bb3aa (patch)
tree1852d62e3260d076a4aba2f5ad9472e967670006
parentevas: Remove group_del override from smart clipped (diff)
downloadefl-67798ca8636c362d947f33bb793ab9480d0bb3aa.tar.gz
evas: Remove group_add from clipped smart object
Moved from clipped to the general smart object class.
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c50
-rw-r--r--src/lib/evas/canvas/evas_object_smart_clipped.c41
-rw-r--r--src/lib/evas/include/evas_private.h1
3 files changed, 45 insertions, 47 deletions
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index e94f788606..cf6d025117 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -711,14 +711,49 @@ _evas_object_smart_clipped_smart_move_internal(Evas_Object *eo_obj, Evas_Coord x
_evas_object_smart_move_relative_internal(o, x - orig_x, y - orig_y);
}
+void
+_evas_object_smart_clipped_init(Evas_Object *eo_obj)
+{
+ EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj);
+ Evas_Object_Smart_Clipped_Data *cso;
+ Evas_Object *clipper;
+
+ // user may realloc this... (legacy only!)
+ cso = o->data;
+ if (!cso)
+ {
+ cso = calloc(1, sizeof(*cso));
+ o->data_nofree = EINA_FALSE;
+ }
+
+ cso->evas = evas_object_evas_get(eo_obj);
+ clipper = evas_object_rectangle_add(cso->evas);
+ evas_object_static_clip_set(clipper, 1);
+ cso->clipper = NULL;
+ evas_object_smart_member_add(clipper, eo_obj);
+ cso->clipper = clipper;
+ evas_object_color_set(cso->clipper, 255, 255, 255, 255);
+ evas_object_move(cso->clipper, -100000, -100000);
+ evas_object_resize(cso->clipper, 200000, 200000);
+ evas_object_pass_events_set(cso->clipper, 1);
+ evas_object_hide(cso->clipper); /* show when have something clipped to it */
+ efl_canvas_object_no_render_set(cso->clipper, 1);
+
+ evas_object_smart_data_set(eo_obj, cso);
+}
+
EOLIAN static void
-_efl_canvas_group_group_add(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED)
+_efl_canvas_group_group_add(Eo *eo_obj, Evas_Smart_Data *o)
{
- // If this function is reached, so we do nothing except trying to call
- // the function of the legacy smart class.
+ // We shouldn't reach this function in case of legacy API.
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
- Evas_Smart *s = obj->smart.smart;
- if (s && s->smart_class->add) s->smart_class->add(eo_obj);
+ EINA_SAFETY_ON_FALSE_RETURN(!obj->smart.smart);
+
+ if (!o->unclipped)
+ {
+ if (!o->data) o->unclipped = EINA_TRUE;
+ else _evas_object_smart_clipped_init(eo_obj);
+ }
}
EOLIAN static void
@@ -733,7 +768,7 @@ _efl_canvas_group_group_del(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o)
{
clipper = cso->clipper;
cso->clipper = NULL;
- efl_del(clipper);
+ evas_object_del(clipper);
}
_efl_canvas_group_group_members_all_del_internal(o);
}
@@ -781,7 +816,8 @@ evas_object_smart_attach(Evas_Object *eo_obj, Evas_Smart *s)
}
}
- efl_canvas_group_add(eo_obj);
+ //efl_canvas_group_add(eo_obj);
+ if (s->smart_class->add) s->smart_class->add(eo_obj);
}
EAPI void
diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c
index 48e576ea7a..6c2c8ea080 100644
--- a/src/lib/evas/canvas/evas_object_smart_clipped.c
+++ b/src/lib/evas/canvas/evas_object_smart_clipped.c
@@ -22,42 +22,9 @@ evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
}
static void
-evas_object_smart_clipped_init(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso)
-{
- Evas_Object *clipper;
-
- cso->evas = evas_object_evas_get(eo_obj);
- clipper = evas_object_rectangle_add(cso->evas);
- evas_object_static_clip_set(clipper, 1);
- cso->clipper = NULL;
- evas_object_smart_member_add(clipper, eo_obj);
- cso->clipper = clipper;
- evas_object_color_set(cso->clipper, 255, 255, 255, 255);
- evas_object_move(cso->clipper, -100000, -100000);
- evas_object_resize(cso->clipper, 200000, 200000);
- evas_object_pass_events_set(cso->clipper, 1);
- evas_object_hide(cso->clipper); /* show when have something clipped to it */
- efl_canvas_object_no_render_set(cso->clipper, 1);
-
- 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_init(eo_obj, cso);
-}
-
-EOLIAN static void
-_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, void *_pd EINA_UNUSED)
-{
- Evas_Object_Smart_Clipped_Data *cso;
-
- cso = evas_object_smart_data_get(eo_obj);
- evas_object_smart_clipped_init(eo_obj, cso);
+ _evas_object_smart_clipped_init(eo_obj);
}
static void
@@ -245,10 +212,4 @@ evas_object_smart_clipped_class_get(void)
return class;
}
-/* Internal EO APIs and hidden overrides */
-
-#define EFL_CANVAS_GROUP_CLIPPED_EXTRA_OPS \
- EFL_CANVAS_GROUP_ADD_OPS(efl_canvas_group_clipped)
-
#include "canvas/efl_canvas_group_clipped.eo.c"
-
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 4364cd6259..eef174fd99 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1732,6 +1732,7 @@ const Eina_List *evas_object_event_grabber_members_list(const Eo *eo_obj);
const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj);
void _efl_canvas_group_group_members_all_del(Evas_Object *eo_obj);
+void _evas_object_smart_clipped_init(Evas_Object *eo_obj);
void _evas_object_smart_clipped_smart_move_internal(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y);
void evas_call_smarts_calculate(Evas *e);
void evas_object_smart_bounding_box_update(Evas_Object_Protected_Data *obj);