+pui_error
+pui_ani_control(pui_ani_h ani_h, pui_ani_cmd cmd, int repeat)
+{
+ return _pui_ani_control_with_force(ani_h, cmd, repeat, 0);
+}
+
+static Eina_Bool
+_cb_visibility_change(void *data, int type EINA_UNUSED, void *event)
+{
+ pui_ani_h ani_h = (pui_ani_h)data;
+ pui_ani_t *ani = ani_h->ani;
+ pui_h ph = ani_h->pui_handle;
+
+ Ecore_Wl2_Event_Window_Visibility_Change *ev;
+ PUI_Event_Animation_Status *e = NULL;
+
+ ev = event;
+
+ /* check if this is needed */
+ ph->visibility = !(ev->fully_obscured);
+
+ if (ev->fully_obscured)
+ {
+ if (ani->status == PUI_ANI_STATUS_RUNNING)
+ {
+ pui_info("animation(%s) will be stopped as it lost its priority !\n", ani->id);
+
+ _pui_ani_control_with_force(ani_h, PUI_ANI_CMD_STOP, 0, 1);
+ }
+ }
+ else
+ {
+ if (ani->status == PUI_ANI_STATUS_PAUSED)
+ {
+ e = (PUI_Event_Animation_Status *)calloc(1, sizeof(PUI_Event_Animation_Status));
+
+ if (!e)
+ {
+ pui_err("Failed to allocate memory for PUI Event !\n");
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ e->ani_h = ani_h;
+ e->win = ev->win;
+ e->status = ani->status;
+
+ if(ani->status == PUI_ANI_STATUS_PAUSED)
+ {
+ pui_info("[Event added][ani id:%s] PUI_EVENT_ANI_READY_TO_RESUME event has been added.\n", ani_h->id);
+ ecore_event_add(PUI_EVENT_ANI_READY_TO_RESUME, e, NULL, ani_h);
+ }
+ }
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_pui_ani_event_handlers_init(pui_ani_h ani_h)
+{
+ Ecore_Event_Handler *h = NULL;
+
+ if (!ani_h)
+ {
+ pui_err("Invalid handle !\n");
+ return;
+ }
+
+ if (!ani_h->ecore_event_hdls)
+ ani_h->ecore_event_hdls = eina_array_new(1);
+
+ h = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, _cb_visibility_change, ani_h);
+ eina_array_push(ani_h->ecore_event_hdls, h);
+
+}
+
+static void
+_pui_ani_event_handlers_shutdown(pui_ani_h ani_h)
+{
+ if (!ani_h)
+ {
+ pui_err("Invalid handle !\n");
+ return;
+ }
+
+ if (ani_h->ecore_event_hdls)
+ {
+ while (eina_array_count(ani_h->ecore_event_hdls))
+ ecore_event_handler_del(eina_array_pop(ani_h->ecore_event_hdls));
+
+ eina_array_free(ani_h->ecore_event_hdls);
+ ani_h->ecore_event_hdls = NULL;
+ }
+}
+