edje: add back use of Ecore_Animator when the Edje object is created on an non Ecore_...
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 5 Feb 2016 05:02:29 +0000 (06:02 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 5 Feb 2016 05:02:29 +0000 (06:02 +0100)
This is necessary for backward compatibility still I am thinking of displaying a warning for this
use case and request people to update there work and drop that feature in the future (In a year
maybe from now). Elementary doesn't need this as it depends on Ecore_Evas.

src/lib/edje/edje_load.c
src/lib/edje/edje_private.h
src/lib/edje/edje_program.c
src/lib/edje/edje_smart.c

index 06f783c..4f0e070 100644 (file)
@@ -1652,6 +1652,7 @@ _edje_file_del(Edje *ed)
      }
    _edje_animators = eina_list_remove(_edje_animators, ed);
    eo_do(ed->obj, eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _edje_timer_cb, ed));
+   ecore_animator_del(ed->animator);
 
    if (ed->pending_actions)
      {
index 3dcca2f..fe82a6c 100644 (file)
@@ -1611,6 +1611,8 @@ struct _Edje
 
    Edje_Perspective     *persp;
 
+   Ecore_Animator       *animator;
+
    const Edje_Signal_Callback_Group *callbacks;
 
    struct {
@@ -1684,6 +1686,7 @@ struct _Edje
    Eina_Bool          update_hints : 1;
    Eina_Bool          recalc_hints : 1;
    Eina_Bool          need_map_update : 1;
+   Eina_Bool          canvas_animator : 1;
 };
 
 struct _Edje_Calc_Params_Map
index 753de78..2adaf7d 100644 (file)
@@ -8,6 +8,13 @@ Eina_List *_edje_animators = NULL;
 static double _edje_transition_duration_scale = 0;
 
 static Eina_Bool
+_edje_animator_cb(void *data)
+{
+   _edje_timer_cb(data, NULL, NULL, NULL);
+   return EINA_TRUE;
+}
+
+static Eina_Bool
 _edje_emit_aliased(Edje *ed, const char *part, const char *sig, const char *src)
 {
    char *alias, *aliased;
@@ -426,6 +433,8 @@ _edje_program_run_cleanup(Edje *ed, Edje_Running_Program *runp)
    if (!ed->actions)
      {
         eo_do(ed->obj, eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _edje_timer_cb, ed));
+        ecore_animator_del(ed->animator);
+        ed->animator = NULL;
      }
 }
 
@@ -726,7 +735,10 @@ low_mem_current:
 
              if (!ed->actions)
                {
-                  eo_do(ed->obj, eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _edje_timer_cb, ed));
+                  if (ed->canvas_animator)
+                    eo_do(ed->obj, eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _edje_timer_cb, ed));
+                  else
+                    ed->animator = ecore_animator_add(_edje_animator_cb, ed);
                }
              ed->actions = eina_list_append(ed->actions, runp);
 
index 500ef3c..fd06cc2 100644 (file)
@@ -27,6 +27,10 @@ edje_object_add(Evas *evas)
 EOLIAN static Eo *
 _edje_object_eo_base_constructor(Eo *obj, Edje *ed)
 {
+   Eo *parent;
+   Evas *e;
+   void *tmp;
+
    ed->base = eo_data_ref(obj, EVAS_SMART_CLIPPED_CLASS);
    ed->duration_scale = 1.0;
 
@@ -34,6 +38,12 @@ _edje_object_eo_base_constructor(Eo *obj, Edje *ed)
    eo_do(obj, evas_obj_type_set(MY_CLASS_NAME_LEGACY));
    _edje_lib_ref();
 
+   eo_do(obj, parent = eo_parent_get());
+   e = evas_object_evas_get(parent);
+   tmp = ecore_evas_ecore_evas_get(e);
+
+   ed->canvas_animator = !!tmp;
+
    return obj;
 }