summaryrefslogtreecommitdiff
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
parente380dae4bc927f9710fa89c2831ebfa733b0e013 (diff)
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 e94f788..cf6d025 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
711 _evas_object_smart_move_relative_internal(o, x - orig_x, y - orig_y); 711 _evas_object_smart_move_relative_internal(o, x - orig_x, y - orig_y);
712} 712}
713 713
714void
715_evas_object_smart_clipped_init(Evas_Object *eo_obj)
716{
717 EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj);
718 Evas_Object_Smart_Clipped_Data *cso;
719 Evas_Object *clipper;
720
721 // user may realloc this... (legacy only!)
722 cso = o->data;
723 if (!cso)
724 {
725 cso = calloc(1, sizeof(*cso));
726 o->data_nofree = EINA_FALSE;
727 }
728
729 cso->evas = evas_object_evas_get(eo_obj);
730 clipper = evas_object_rectangle_add(cso->evas);
731 evas_object_static_clip_set(clipper, 1);
732 cso->clipper = NULL;
733 evas_object_smart_member_add(clipper, eo_obj);
734 cso->clipper = clipper;
735 evas_object_color_set(cso->clipper, 255, 255, 255, 255);
736 evas_object_move(cso->clipper, -100000, -100000);
737 evas_object_resize(cso->clipper, 200000, 200000);
738 evas_object_pass_events_set(cso->clipper, 1);
739 evas_object_hide(cso->clipper); /* show when have something clipped to it */
740 efl_canvas_object_no_render_set(cso->clipper, 1);
741
742 evas_object_smart_data_set(eo_obj, cso);
743}
744
714EOLIAN static void 745EOLIAN static void
715_efl_canvas_group_group_add(Eo *eo_obj, Evas_Smart_Data *o EINA_UNUSED) 746_efl_canvas_group_group_add(Eo *eo_obj, Evas_Smart_Data *o)
716{ 747{
717 // If this function is reached, so we do nothing except trying to call 748 // We shouldn't reach this function in case of legacy API.
718 // the function of the legacy smart class.
719 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 749 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
720 Evas_Smart *s = obj->smart.smart; 750 EINA_SAFETY_ON_FALSE_RETURN(!obj->smart.smart);
721 if (s && s->smart_class->add) s->smart_class->add(eo_obj); 751
752 if (!o->unclipped)
753 {
754 if (!o->data) o->unclipped = EINA_TRUE;
755 else _evas_object_smart_clipped_init(eo_obj);
756 }
722} 757}
723 758
724EOLIAN static void 759EOLIAN static void
@@ -733,7 +768,7 @@ _efl_canvas_group_group_del(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *o)
733 { 768 {
734 clipper = cso->clipper; 769 clipper = cso->clipper;
735 cso->clipper = NULL; 770 cso->clipper = NULL;
736 efl_del(clipper); 771 evas_object_del(clipper);
737 } 772 }
738 _efl_canvas_group_group_members_all_del_internal(o); 773 _efl_canvas_group_group_members_all_del_internal(o);
739 } 774 }
@@ -781,7 +816,8 @@ evas_object_smart_attach(Evas_Object *eo_obj, Evas_Smart *s)
781 } 816 }
782 } 817 }
783 818
784 efl_canvas_group_add(eo_obj); 819 //efl_canvas_group_add(eo_obj);
820 if (s->smart_class->add) s->smart_class->add(eo_obj);
785} 821}
786 822
787EAPI void 823EAPI void
diff --git a/src/lib/evas/canvas/evas_object_smart_clipped.c b/src/lib/evas/canvas/evas_object_smart_clipped.c
index 48e576e..6c2c8ea 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)
22} 22}
23 23
24static void 24static void
25evas_object_smart_clipped_init(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso)
26{
27 Evas_Object *clipper;
28
29 cso->evas = evas_object_evas_get(eo_obj);
30 clipper = evas_object_rectangle_add(cso->evas);
31 evas_object_static_clip_set(clipper, 1);
32 cso->clipper = NULL;
33 evas_object_smart_member_add(clipper, eo_obj);
34 cso->clipper = clipper;
35 evas_object_color_set(cso->clipper, 255, 255, 255, 255);
36 evas_object_move(cso->clipper, -100000, -100000);
37 evas_object_resize(cso->clipper, 200000, 200000);
38 evas_object_pass_events_set(cso->clipper, 1);
39 evas_object_hide(cso->clipper); /* show when have something clipped to it */
40 efl_canvas_object_no_render_set(cso->clipper, 1);
41
42 evas_object_smart_data_set(eo_obj, cso);
43}
44
45static void
46evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj) 25evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj)
47{ 26{
48 Evas_Object_Smart_Clipped_Data *cso; 27 _evas_object_smart_clipped_init(eo_obj);
49
50 cso = calloc(1, sizeof(*cso));
51 evas_object_smart_clipped_init(eo_obj, cso);
52}
53
54EOLIAN static void
55_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, void *_pd EINA_UNUSED)
56{
57 Evas_Object_Smart_Clipped_Data *cso;
58
59 cso = evas_object_smart_data_get(eo_obj);
60 evas_object_smart_clipped_init(eo_obj, cso);
61} 28}
62 29
63static void 30static void
@@ -245,10 +212,4 @@ evas_object_smart_clipped_class_get(void)
245 return class; 212 return class;
246} 213}
247 214
248/* Internal EO APIs and hidden overrides */
249
250#define EFL_CANVAS_GROUP_CLIPPED_EXTRA_OPS \
251 EFL_CANVAS_GROUP_ADD_OPS(efl_canvas_group_clipped)
252
253#include "canvas/efl_canvas_group_clipped.eo.c" 215#include "canvas/efl_canvas_group_clipped.eo.c"
254
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 4364cd6..eef174f 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);
1732 1732
1733const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj); 1733const Eina_Inlist *evas_object_smart_members_get_direct(const Evas_Object *obj);
1734void _efl_canvas_group_group_members_all_del(Evas_Object *eo_obj); 1734void _efl_canvas_group_group_members_all_del(Evas_Object *eo_obj);
1735void _evas_object_smart_clipped_init(Evas_Object *eo_obj);
1735void _evas_object_smart_clipped_smart_move_internal(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y); 1736void _evas_object_smart_clipped_smart_move_internal(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y);
1736void evas_call_smarts_calculate(Evas *e); 1737void evas_call_smarts_calculate(Evas *e);
1737void evas_object_smart_bounding_box_update(Evas_Object_Protected_Data *obj); 1738void evas_object_smart_bounding_box_update(Evas_Object_Protected_Data *obj);