From 7c0825aec45744e558ef61dd8f4ef73cf0de7fa9 Mon Sep 17 00:00:00 2001 From: Changwoo KIM Date: Fri, 19 Jul 2019 13:53:35 +0900 Subject: [PATCH] Considering 3 entry point for manual render start 1. Pre-Visilibity Event (Only for LCD ON State) 2. AppControl Event 3. Evas Object Move Event For LCD Off/Evas Object Move Event case, wathcface will be paused by auto visibility check But in case of AppControl, there is no visibility check to pause watchface. So add new timer for 200ms to check iconify state. Once watchface got resume on iconify state, the timer will check it's visibility and pause the watchface Change-Id: Ic68f55588dfb550fdd76148b82504f4e41a2651f Signed-off-by: hyunho --- watch-control/src/control.c | 85 ++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/watch-control/src/control.c b/watch-control/src/control.c index 4f04273..19b2538 100644 --- a/watch-control/src/control.c +++ b/watch-control/src/control.c @@ -73,6 +73,7 @@ struct manual_render_s { Ecore_Event_Handler *pre_visibility; Ecore_Event_Handler *visibility; guint timer; + guint pause_timer; bool started; }; @@ -106,20 +107,17 @@ static gboolean __manual_render_timeout_cb(gpointer data) { _W("Manual render timeout expired"); watch_manager_pause(); - watch_manager_notify_paused_status_of_viewer(); - __manual_render.timer = 0; __manual_render_stop(); - + __manual_render.timer = 0; return G_SOURCE_REMOVE; } -static void __manual_render_set_timer(void) +static gboolean __pause_timeout_cb(gpointer data) { - if (__manual_render.timer) - return; + if (elm_win_iconified_get(__win)) + watch_manager_pause(); - __manual_render.timer = g_timeout_add(200, __manual_render_timeout_cb, - NULL); + return G_SOURCE_REMOVE; } static void __manual_render_unset_timer(void) @@ -131,6 +129,15 @@ static void __manual_render_unset_timer(void) __manual_render.timer = 0; } +static void __manual_render_set_timer(void) +{ + if (__manual_render.timer) + __manual_render_unset_timer(); + + __manual_render.timer = g_timeout_add(200, __manual_render_timeout_cb, + NULL); +} + static void __manual_render_start(void) { if (!__watch_is_visible()) { @@ -171,19 +178,37 @@ static void __manual_render_stop(void) static void __aul_watch_control_cb(bundle *b, void *user_data) { - if (!__watch_is_visible()) - return; + bool v = __watch_is_visible(); + bool i = elm_win_iconified_get(__win); + if (!v) + return; __manual_render_start(); + if (i) { + _D("Watch AppControl obj visibility[%d] win visibility[%d]", v, !i); + if (__manual_render.pause_timer) + g_source_remove(__manual_render.pause_timer); + + __manual_render.pause_timer = g_timeout_add(200, __pause_timeout_cb, + NULL); + } +} + +static gboolean __delay_resume_cb(gpointer data) +{ + watch_manager_resume(); + return G_SOURCE_REMOVE; } static void __obj_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { - if (!__watch_is_visible()) - return; + bool v = __watch_is_visible(); + if (!v) + return; __manual_render_start(); + g_idle_add(__delay_resume_cb, NULL); } static Eina_Bool __window_on_pre_visibility(void *data, int type, void *event) @@ -216,35 +241,6 @@ static Eina_Bool __window_on_pre_visibility(void *data, int type, void *event) return ECORE_CALLBACK_RENEW; } -static Eina_Bool __window_on_visibility(void *data, int type, void *event) -{ - Ecore_Wl2_Event_Window_Visibility_Change *ev = event; - Ecore_Evas *ee; - Ecore_Wl2_Window *wl_win; - int win_id; - - if (!ev) - return ECORE_CALLBACK_RENEW; - - ee = ecore_evas_ecore_evas_get(evas_object_evas_get(__win)); - if (!ee) - return ECORE_CALLBACK_RENEW; - - wl_win = ecore_evas_wayland2_window_get(ee); - if (!wl_win) - return ECORE_CALLBACK_RENEW; - - win_id = ecore_wl2_window_id_get(wl_win); - if (ev->win != win_id) - return ECORE_CALLBACK_RENEW; - - if (!ev->fully_obscured) { - LOGD("[__WINDOW_VISIBILITY_CHANGE__] win_id(%d)", ev->win); - __manual_render_unset_timer(); - } - - return ECORE_CALLBACK_RENEW; -} static int __manual_render_init(void) { @@ -262,13 +258,6 @@ static int __manual_render_init(void) __window_on_pre_visibility, NULL); if (!__manual_render.pre_visibility) _W("Failed to add pre visibility change handler"); - - __manual_render.visibility = ecore_event_handler_add( - ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, - __window_on_visibility, NULL); - if (!__manual_render.visibility) - _W("Failed to add visibility change handler"); - return 0; } -- 2.7.4