PUI: fix frame_cb and pui_ani_control not to make irregular timer callback call 06/220706/1
authorSung-Jin Park <sj76.park@samsung.com>
Mon, 16 Sep 2019 06:48:57 +0000 (15:48 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 20 Dec 2019 09:55:16 +0000 (18:55 +0900)
Change-Id: Ib398989b9bd5e6ef287d940824cf5243f631f64a
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/PUI.c
src/PUI_ani.c

index f7fa28e..cf0d35b 100644 (file)
--- a/src/PUI.c
+++ b/src/PUI.c
@@ -122,7 +122,7 @@ pui_display_get_buffer(pui_h handle)
 
        if (!tbm_surface_queue_can_dequeue(handle->tbm_queue, 0))
        {
-               pui_err("[UPDATE] Cannot dequeue (error : PUI_ERROR_INTERNAL)\n");
+               pui_err("Failed to dequeue a tbm_surface !\n");
                return NULL;
        }
 
@@ -565,7 +565,6 @@ pui_init(void)
                goto error;
        }
 
-       //TODO
        ecore_wl2_init();
 
        _pui_event_init();
index e733987..28db340 100644 (file)
@@ -124,6 +124,7 @@ static Eina_Bool
 _pui_ani_frame_cb(void *data)
 {
        Eina_Bool ret;
+       Ecore_Timer *timer = NULL;
 
        pui_ani_t *ani = (pui_ani_t *)data;
 
@@ -161,7 +162,20 @@ _pui_ani_frame_cb(void *data)
        if (ret && PUI_ANI_STATUS_STARTED == ani->status)
                pui_ani_status_update(ani, PUI_ANI_STATUS_RUNNING);
 
-       return EINA_TRUE;
+       ecore_timer_del(ani->frame_cb_timer);
+       ani->frame_cb_timer = NULL;
+
+       timer = ecore_timer_add(ani->frame_interval, _pui_ani_frame_cb, ani);
+
+       if (!timer)
+       {
+               pui_err("Failed to add ecore timer !\n");
+               return 0;
+       }
+
+       ani->frame_cb_timer = timer;
+
+       return EINA_FALSE;
 }
 
 pui_bool
@@ -423,6 +437,9 @@ _pui_ani_control_with_force(pui_ani_h ani_h, pui_ani_cmd cmd, int repeat, pui_bo
        {
                ei = ani_func->ani_stop(ani, force);
 
+               if (ani->frame_cb_timer)
+                       pui_ani_remove_frame_cb(ani);
+
                if (ei != PUI_INT_ERROR_NONE)
                {
                        pui_err("Failied on stopping animation ! (id:%s)\n", ani->id);
@@ -430,9 +447,6 @@ _pui_ani_control_with_force(pui_ani_h ani_h, pui_ani_cmd cmd, int repeat, pui_bo
                        if (ani->status != PUI_ANI_STATUS_STOPPED)
                                pui_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
 
-                       if (ani->frame_cb_timer)
-                               pui_ani_remove_frame_cb(ani);
-
                        return PUI_ERROR_INTERNAL;
                }