cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b02d34a839e5b721a0bdb2178187d6d50efad38f

commit b02d34a839e5b721a0bdb2178187d6d50efad38f
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Fri Feb 5 06:02:29 2016 +0100

    edje: add back use of Ecore_Animator when the Edje object is created on an 
non Ecore_Evas canvas.
    
    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    |  1 +
 src/lib/edje/edje_private.h |  3 +++
 src/lib/edje/edje_program.c | 14 +++++++++++++-
 src/lib/edje/edje_smart.c   | 10 ++++++++++
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 06f783c..4f0e070 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -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)
      {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 3dcca2f..fe82a6c 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -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
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 753de78..2adaf7d 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -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);
 
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 500ef3c..fd06cc2 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -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;
 }
 

-- 


Reply via email to