From 327629f902495237a867ff2d192815c868e753d8 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 16 Sep 2019 15:48:57 +0900 Subject: [PATCH] PUI: fix frame_cb and pui_ani_control not to make irregular timer callback call Change-Id: Ib398989b9bd5e6ef287d940824cf5243f631f64a Signed-off-by: Sung-Jin Park --- src/PUI.c | 3 +-- src/PUI_ani.c | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/PUI.c b/src/PUI.c index f7fa28e..cf0d35b 100644 --- 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(); diff --git a/src/PUI_ani.c b/src/PUI_ani.c index e733987..28db340 100644 --- a/src/PUI_ani.c +++ b/src/PUI_ani.c @@ -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; } -- 2.7.4