summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-08-19 16:20:39 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-26 10:18:01 +0900
commit57f0c850ec5011313b5ac2f3407b547ef149ac18 (patch)
treeb0ceee2be38c31a69cebba08e1f902ab15657d0e
parent4746627fcfcdda9b73636d0f2a98def6a526b940 (diff)
evas: Move event catcher to evas_callbacks.c
No functional change.
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c67
-rw-r--r--src/lib/evas/canvas/evas_object_main.c64
-rw-r--r--src/lib/evas/include/evas_private.h1
3 files changed, 69 insertions, 63 deletions
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 7de24a3510..6c6f9026df 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -578,3 +578,70 @@ evas_post_event_callback_remove_full(Evas *eo_e, Evas_Object_Event_Post_Cb func,
578 } 578 }
579 } 579 }
580} 580}
581
582static void
583_animator_repeater(void *data, const Eo_Event *event)
584{
585 Evas_Object_Protected_Data *obj = data;
586
587 efl_event_callback_call(obj->object, EFL_EVENT_ANIMATOR_TICK, event->info);
588 DBG("Emitting animator tick on %p.", obj->object);
589}
590
591static void
592_check_event_catcher_add(void *data, const Eo_Event *event)
593{
594 const Efl_Callback_Array_Item *array = event->info;
595 Evas_Object_Protected_Data *obj = data;
596 int i;
597
598 for (i = 0; array[i].desc != NULL; i++)
599 {
600 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
601 {
602 if (obj->animator_ref++ > 0) break;
603
604 efl_event_callback_add(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
605 INF("Registering an animator tick on canvas %p for object %p.",
606 obj->layer->evas->evas, obj->object);
607 }
608 else if (array[i].desc == EFL_GFX_EVENT_MOVE)
609 {
610 obj->move_ref++;
611 }
612 }
613}
614
615static void
616_check_event_catcher_del(void *data, const Eo_Event *event)
617{
618 const Efl_Callback_Array_Item *array = event->info;
619 Evas_Object_Protected_Data *obj = data;
620 int i;
621
622 for (i = 0; array[i].desc != NULL; i++)
623 {
624 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
625 {
626 if ((--obj->animator_ref) > 0) break;
627
628 efl_event_callback_del(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
629 INF("Unregistering an animator tick on canvas %p for object %p.",
630 obj->layer->evas->evas, obj->object);
631 }
632 else if (array[i].desc == EFL_GFX_EVENT_MOVE)
633 {
634 obj->move_ref--;
635 }
636 }
637}
638
639EFL_CALLBACKS_ARRAY_DEFINE(event_catcher_watch,
640 { EFL_EVENT_CALLBACK_ADD, _check_event_catcher_add },
641 { EFL_EVENT_CALLBACK_DEL, _check_event_catcher_del });
642
643void
644evas_object_callback_init(Efl_Canvas_Object *eo_obj, Evas_Object_Protected_Data *obj)
645{
646 efl_event_callback_array_add(eo_obj, event_catcher_watch(), obj);
647}
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index 2f95012a4e..d7e3aa570f 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -86,67 +86,6 @@ _init_cow(void)
86 return EINA_TRUE; 86 return EINA_TRUE;
87} 87}
88 88
89static void
90_animator_repeater(void *data, const Eo_Event *event)
91{
92 Evas_Object_Protected_Data *obj = data;
93
94 efl_event_callback_call(obj->object, EFL_EVENT_ANIMATOR_TICK, event->info);
95 DBG("Emitting animator tick on %p.", obj->object);
96}
97
98static void
99_check_event_catcher_add(void *data, const Eo_Event *event)
100{
101 const Efl_Callback_Array_Item *array = event->info;
102 Evas_Object_Protected_Data *obj = data;
103 int i;
104
105 for (i = 0; array[i].desc != NULL; i++)
106 {
107 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
108 {
109 if (obj->animator_ref++ > 0) break;
110
111 efl_event_callback_add(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
112 INF("Registering an animator tick on canvas %p for object %p.",
113 obj->layer->evas->evas, obj->object);
114 }
115 else if (array[i].desc == EFL_GFX_EVENT_MOVE)
116 {
117 obj->move_ref++;
118 }
119 }
120}
121
122static void
123_check_event_catcher_del(void *data, const Eo_Event *event)
124{
125 const Efl_Callback_Array_Item *array = event->info;
126 Evas_Object_Protected_Data *obj = data;
127 int i;
128
129 for (i = 0; array[i].desc != NULL; i++)
130 {
131 if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
132 {
133 if ((--obj->animator_ref) > 0) break;
134
135 efl_event_callback_del(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
136 INF("Unregistering an animator tick on canvas %p for object %p.",
137 obj->layer->evas->evas, obj->object);
138 }
139 else if (array[i].desc == EFL_GFX_EVENT_MOVE)
140 {
141 obj->move_ref--;
142 }
143 }
144}
145
146EFL_CALLBACKS_ARRAY_DEFINE(event_catcher_watch,
147 { EFL_EVENT_CALLBACK_ADD, _check_event_catcher_add },
148 { EFL_EVENT_CALLBACK_DEL, _check_event_catcher_del });
149
150EOLIAN static Eo * 89EOLIAN static Eo *
151_efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data *obj) 90_efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
152{ 91{
@@ -176,8 +115,7 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
176 obj->mask = eina_cow_alloc(evas_object_mask_cow); 115 obj->mask = eina_cow_alloc(evas_object_mask_cow);
177 116
178 evas_object_inject(eo_obj, obj, evas); 117 evas_object_inject(eo_obj, obj, evas);
179 118 evas_object_callback_init(eo_obj, obj);
180 efl_event_callback_array_add(eo_obj, event_catcher_watch(), obj);
181 119
182 return eo_obj; 120 return eo_obj;
183} 121}
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 973b28f9dc..5964a66f1c 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1551,6 +1551,7 @@ void evas_object_clip_across_check(Evas_Object *obj, Evas_Object_Protected_Data
1551void evas_object_clip_across_clippees_check(Evas_Object *obj, Evas_Object_Protected_Data *pd); 1551void evas_object_clip_across_clippees_check(Evas_Object *obj, Evas_Object_Protected_Data *pd);
1552void evas_object_mapped_clip_across_mark(Evas_Object *obj, Evas_Object_Protected_Data *pd); 1552void evas_object_mapped_clip_across_mark(Evas_Object *obj, Evas_Object_Protected_Data *pd);
1553void evas_event_callback_call(Evas *e, Evas_Callback_Type type, void *event_info); 1553void evas_event_callback_call(Evas *e, Evas_Callback_Type type, void *event_info);
1554void evas_object_callback_init(Efl_Canvas_Object *eo_obj, Evas_Object_Protected_Data *obj);
1554void evas_object_event_callback_call(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Callback_Type type, void *event_info, int event_id, const Efl_Event_Description *efl_event_desc, Efl_Event *efl_event_info); 1555void evas_object_event_callback_call(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Callback_Type type, void *event_info, int event_id, const Efl_Event_Description *efl_event_desc, Efl_Event *efl_event_info);
1555Eina_List *evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y); 1556Eina_List *evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y);
1556int evas_mem_free(int mem_required); 1557int evas_mem_free(int mem_required);