"bub3", "sh3",
};
-static void
-_del(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Evas_Object *win = data;
- Ecore_Animator *ani = evas_object_data_get(win, "animator");
-
- ecore_animator_del(ani);
-}
-
static Eina_Bool
-anim(void *data)
+_anim_tick(void *data EINA_UNUSED, Eo *win, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win = data;
Evas_Object *bub, *sh;
Evas_Coord x, y, w, h, vw, vh;
double t, xx, yy, zz, r, fac;
test_anim(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *win, *bg, *bub, *sh;
- Ecore_Animator *ani;
char buf[PATH_MAX];
unsigned int i;
evas_object_resize(win, 480, 800);
evas_object_show(win);
- ani = ecore_animator_add(anim, win);
- evas_object_data_set(win, "animator", ani);
-
- evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _del, win);
+ eo_do(win, eo_event_callback_add(ELM_WIN_EVENT_ANIMATOR_TICK, _anim_tick, NULL));
}
void *trap_data;
+ struct
+ {
+ Ecore_Animator *obj;
+ unsigned short wants;
+ } animator;
+
double aspect;
int size_base_w, size_base_h;
int size_step_w, size_step_h;
return EINA_FALSE;
}
+static Eina_Bool
+_animator_tick_cb(void *_obj)
+{
+ Elm_Win *obj = _obj;
+ eo_do(obj, eo_event_callback_call(ELM_WIN_EVENT_ANIMATOR_TICK, NULL));
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_cb_added(void *_data,
+ Eo *obj,
+ const Eo_Event_Description *desc EINA_UNUSED,
+ void *event_info)
+{
+ const Eo_Callback_Array_Item *event = event_info;
+ Elm_Win_Data *data = _data;
+
+ if (event->desc == ELM_WIN_EVENT_ANIMATOR_TICK)
+ {
+ data->animator.wants++;
+ if (data->animator.wants == 1)
+ {
+ data->animator.obj = eo_add(ECORE_ANIMATOR_CLASS, obj,
+ ecore_animator_constructor(_animator_tick_cb, obj));
+ }
+ }
+
+ return EO_CALLBACK_CONTINUE;
+}
+
+static Eina_Bool
+_cb_deled(void *_data,
+ Eo *obj EINA_UNUSED,
+ const Eo_Event_Description *desc EINA_UNUSED,
+ void *event_info)
+{
+ const Eo_Callback_Array_Item *event = event_info;
+ Elm_Win_Data *data = _data;
+
+ if (event->desc == ELM_WIN_EVENT_ANIMATOR_TICK)
+ {
+ data->animator.wants--;
+ if (data->animator.wants == 0)
+ {
+ eo_del(data->animator.obj);
+ data->animator.obj = NULL;
+ }
+ }
+
+ return EO_CALLBACK_CONTINUE;
+}
+
EOLIAN static void
_elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type type)
{
}
evas_object_show(sd->edje);
+
+ eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_ADD, _cb_added, sd),
+ eo_event_callback_add(EO_EV_CALLBACK_DEL, _cb_deled, sd));
}
EOLIAN static void