Render in pre resume callback forcefully 82/147782/1 tizen_3.0
authorSemun Lee <semun.lee@samsung.com>
Tue, 5 Sep 2017 09:12:48 +0000 (18:12 +0900)
committerSemun Lee <semun.lee@samsung.com>
Tue, 5 Sep 2017 13:50:20 +0000 (22:50 +0900)
PRE_RESUME assumes at least one render, so render forcefully
in time tick callback.

Change-Id: I58cb8be2b041d6eb70683b04b025442e67950942
Signed-off-by: Semun Lee <semun.lee@samsung.com>
include/appcore-watch.h
src/appcore-watch.c
src/watch_app_main.c

index 287af58..054d2bd 100755 (executable)
@@ -36,6 +36,7 @@ struct watchcore_ops {
        int (*resume) (void *); /**< Called when any window comes on top */
        int (*terminate) (void *); /**< This callback function is called once after the main loop of application exits. */
        void (*time_tick) (void *, void *);
+       void (*pre_resume) (void *, void *);
        void (*ambient_tick) (void *, void *);
        void (*ambient_changed) (int, void *);
        void *reserved[6]; /**< Reserved */
index 80f668d..9cdf553 100755 (executable)
@@ -892,7 +892,7 @@ static int __viewer_state_handler(const char *widget_id, aul_app_com_result_e e,
                        && __pre_resume_called == 0) {
                __get_timeinfo(&timeinfo);
                _D("call pre resume tick");
-               priv.ops->time_tick(&timeinfo, priv.ops->data);
+               priv.ops->pre_resume(&timeinfo, priv.ops->data);
                __pre_resume_called = 1;
        }
 
index 0737afe..37dc042 100755 (executable)
@@ -75,6 +75,8 @@ static Eina_List *handler_list[WATCH_APP_EVENT_MAX] = {NULL, };
 static int _initialized = 0;
 static int watch_core_initialized = 0;
 
+static Evas_Object *_watch_win;
+
 struct app_event_handler {
        app_event_type_e type;
        app_event_cb cb;
@@ -331,6 +333,23 @@ static void _watch_core_time_tick(void *watchtime, void *data)
                time_tick_cb((watch_time_h)watchtime, app_context->data);
 }
 
+static void _watch_core_pre_resume(void *watchtime, void *data)
+{
+       int w, h;
+       Ecore_Evas *ee;
+
+       _watch_core_time_tick(watchtime, data);
+
+       if (_watch_win == NULL)
+               return;
+
+       ee = ecore_evas_ecore_evas_get(evas_object_evas_get(_watch_win));
+       evas_output_viewport_get(ecore_evas_get(ee), NULL, NULL, &w, &h);
+       evas_obscured_clear(ecore_evas_get(ee));
+       evas_damage_rectangle_add(ecore_evas_get(ee), 0, 0, w, h);
+       ecore_evas_manual_render(ee);
+}
+
 /* LCOV_EXCL_START */
 static void _watch_core_ambient_tick(void *watchtime, void *data)
 {
@@ -385,6 +404,7 @@ EXPORT_API int watch_app_main(int argc, char **argv,
                .resume = _watch_core_resume,
                .terminate = _watch_core_terminate,
                .time_tick = _watch_core_time_tick,
+               .pre_resume = _watch_core_pre_resume,
                .ambient_tick = _watch_core_ambient_tick,
                .ambient_changed = _watch_core_ambient_changed,
        };
@@ -699,6 +719,8 @@ static void __win_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info
 {
        char *plug_id;
        plug_id = evas_object_data_del(obj, "___PLUGID");
+       if (_watch_win == obj)
+               _watch_win = NULL;
        free(plug_id);
 }
 
@@ -731,6 +753,7 @@ EXPORT_API int watch_app_get_elm_win(Evas_Object **win)
        evas_object_event_callback_add(ret_win, EVAS_CALLBACK_DEL, __win_del_cb, NULL);
 
        *win = ret_win;
+       _watch_win = ret_win;
        return APP_ERROR_NONE;
 }