evas: Move event catcher to evas_callbacks.c
authorJean-Philippe Andre <jp.andre@samsung.com>
Fri, 19 Aug 2016 07:20:39 +0000 (16:20 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Fri, 26 Aug 2016 01:18:01 +0000 (10:18 +0900)
No functional change.

src/lib/evas/canvas/evas_callbacks.c
src/lib/evas/canvas/evas_object_main.c
src/lib/evas/include/evas_private.h

index 7de24a3..6c6f902 100644 (file)
@@ -578,3 +578,70 @@ evas_post_event_callback_remove_full(Evas *eo_e, Evas_Object_Event_Post_Cb func,
           }
      }
 }
+
+static void
+_animator_repeater(void *data, const Eo_Event *event)
+{
+   Evas_Object_Protected_Data *obj = data;
+
+   efl_event_callback_call(obj->object, EFL_EVENT_ANIMATOR_TICK, event->info);
+   DBG("Emitting animator tick on %p.", obj->object);
+}
+
+static void
+_check_event_catcher_add(void *data, const Eo_Event *event)
+{
+   const Efl_Callback_Array_Item *array = event->info;
+   Evas_Object_Protected_Data *obj = data;
+   int i;
+
+   for (i = 0; array[i].desc != NULL; i++)
+     {
+        if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
+          {
+             if (obj->animator_ref++ > 0) break;
+
+             efl_event_callback_add(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
+             INF("Registering an animator tick on canvas %p for object %p.",
+                 obj->layer->evas->evas, obj->object);
+          }
+        else if (array[i].desc == EFL_GFX_EVENT_MOVE)
+          {
+             obj->move_ref++;
+          }
+     }
+}
+
+static void
+_check_event_catcher_del(void *data, const Eo_Event *event)
+{
+   const Efl_Callback_Array_Item *array = event->info;
+   Evas_Object_Protected_Data *obj = data;
+   int i;
+
+   for (i = 0; array[i].desc != NULL; i++)
+     {
+        if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
+          {
+             if ((--obj->animator_ref) > 0) break;
+
+             efl_event_callback_del(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
+             INF("Unregistering an animator tick on canvas %p for object %p.",
+                 obj->layer->evas->evas, obj->object);
+          }
+        else if (array[i].desc == EFL_GFX_EVENT_MOVE)
+          {
+             obj->move_ref--;
+          }
+     }
+}
+
+EFL_CALLBACKS_ARRAY_DEFINE(event_catcher_watch,
+                          { EFL_EVENT_CALLBACK_ADD, _check_event_catcher_add },
+                          { EFL_EVENT_CALLBACK_DEL, _check_event_catcher_del });
+
+void
+evas_object_callback_init(Efl_Canvas_Object *eo_obj, Evas_Object_Protected_Data *obj)
+{
+   efl_event_callback_array_add(eo_obj, event_catcher_watch(), obj);
+}
index 2f95012..d7e3aa5 100644 (file)
@@ -86,67 +86,6 @@ _init_cow(void)
    return EINA_TRUE;
 }
 
-static void
-_animator_repeater(void *data, const Eo_Event *event)
-{
-   Evas_Object_Protected_Data *obj = data;
-
-   efl_event_callback_call(obj->object, EFL_EVENT_ANIMATOR_TICK, event->info);
-   DBG("Emitting animator tick on %p.", obj->object);
-}
-
-static void
-_check_event_catcher_add(void *data, const Eo_Event *event)
-{
-   const Efl_Callback_Array_Item *array = event->info;
-   Evas_Object_Protected_Data *obj = data;
-   int i;
-
-   for (i = 0; array[i].desc != NULL; i++)
-     {
-        if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
-          {
-             if (obj->animator_ref++ > 0) break;
-
-             efl_event_callback_add(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
-             INF("Registering an animator tick on canvas %p for object %p.",
-                 obj->layer->evas->evas, obj->object);
-          }
-        else if (array[i].desc == EFL_GFX_EVENT_MOVE)
-          {
-             obj->move_ref++;
-          }
-     }
-}
-
-static void
-_check_event_catcher_del(void *data, const Eo_Event *event)
-{
-   const Efl_Callback_Array_Item *array = event->info;
-   Evas_Object_Protected_Data *obj = data;
-   int i;
-
-   for (i = 0; array[i].desc != NULL; i++)
-     {
-        if (array[i].desc == EFL_EVENT_ANIMATOR_TICK)
-          {
-             if ((--obj->animator_ref) > 0) break;
-
-             efl_event_callback_del(obj->layer->evas->evas, EFL_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
-             INF("Unregistering an animator tick on canvas %p for object %p.",
-                 obj->layer->evas->evas, obj->object);
-          }
-        else if (array[i].desc == EFL_GFX_EVENT_MOVE)
-          {
-             obj->move_ref--;
-          }
-     }
-}
-
-EFL_CALLBACKS_ARRAY_DEFINE(event_catcher_watch,
-                          { EFL_EVENT_CALLBACK_ADD, _check_event_catcher_add },
-                          { EFL_EVENT_CALLBACK_DEL, _check_event_catcher_del });
-
 EOLIAN static Eo *
 _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
 {
@@ -176,8 +115,7 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
    obj->mask = eina_cow_alloc(evas_object_mask_cow);
 
    evas_object_inject(eo_obj, obj, evas);
-
-   efl_event_callback_array_add(eo_obj, event_catcher_watch(), obj);
+   evas_object_callback_init(eo_obj, obj);
 
    return eo_obj;
 }
index 973b28f..5964a66 100644 (file)
@@ -1551,6 +1551,7 @@ void evas_object_clip_across_check(Evas_Object *obj, Evas_Object_Protected_Data
 void evas_object_clip_across_clippees_check(Evas_Object *obj, Evas_Object_Protected_Data *pd);
 void evas_object_mapped_clip_across_mark(Evas_Object *obj, Evas_Object_Protected_Data *pd);
 void evas_event_callback_call(Evas *e, Evas_Callback_Type type, void *event_info);
+void evas_object_callback_init(Efl_Canvas_Object *eo_obj, Evas_Object_Protected_Data *obj);
 void 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);
 Eina_List *evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y);
 int evas_mem_free(int mem_required);