From ddd80c07dedf1054602c8471a39d3599a0ac1f64 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 8 Aug 2017 11:10:50 +0900 Subject: [PATCH] Recover watch visibility after iconify process Sometimes watch should be paused when viewer window uniconified https://review.tizen.org/gerrit/#/c/142930/ Change-Id: Ic566532b90ecd4cc577a076906c5dec43f97338c Signed-off-by: Hyunho Kang --- watch-control/src/control.c | 73 ++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/watch-control/src/control.c b/watch-control/src/control.c index 9d28db19..bc80ae9a 100644 --- a/watch-control/src/control.c +++ b/watch-control/src/control.c @@ -69,6 +69,7 @@ static unsigned int __watch_rid; static bool __manual_render; static bool __iconified = false; static bool __is_binded = false; +static bool __viewer_visibility = false; static GList *__dead_cbs; struct dead_cb_s { @@ -77,7 +78,8 @@ struct dead_cb_s { }; GQueue *__pending_queue; -static int __change_viewer_visibility(bool visible); +static int __change_viewer_visibility(bool visible, bool update_cur_state); +static int __change_visibility(bool visible); static void __process_pending_status(int status, unsigned int surf) { @@ -136,23 +138,56 @@ static void __win_resized(void *data, Evas *e, Evas_Object *obj, void *event_inf __default_height = h; } -static Eina_Bool __iconify_state_changed(void *data, int type, void *event) +static void __manual_render_start(void) +{ + Evas *evas = evas_object_evas_get(__win); + Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas); + Evas *cur_image = evas_object_data_get(__win, "tbm,watch"); + + __change_viewer_visibility(true, false); + ecore_evas_manual_render_set(ee, EINA_TRUE); + + if (cur_image) + screen_connector_toolkit_evas_send_visibility(cur_image, + VISIBILITY_TYPE_UNOBSCURED); + __manual_render = true; +} + +static void __manual_render_finish(void) { Evas *evas = evas_object_evas_get(__win); Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas); + visibility_type auto_visibility; + + evas = evas_object_evas_get(__win); + ee = ecore_evas_ecore_evas_get(evas); + ecore_evas_manual_render_set(ee, EINA_FALSE); + LOGI("set manual false"); + + if (!__viewer_visibility) + __change_viewer_visibility(__viewer_visibility, false); + + auto_visibility = screen_connector_toolkit_evas_auto_visibility(__toolkit); + if (auto_visibility == VISIBILITY_TYPE_PARTIALLY_OBSCURED || + auto_visibility == VISIBILITY_TYPE_UNOBSCURED) + __change_visibility(true); + else + __change_visibility(false); + + __manual_render = false; +} + +static Eina_Bool __iconify_state_changed(void *data, int type, void *event) +{ Ecore_Wl_Event_Window_Iconify_State_Change *ev = (Ecore_Wl_Event_Window_Iconify_State_Change *)event; LOGI("Iconify state changed, %d, %d", ev->iconified, EINA_TRUE); if (ev->iconified == EINA_FALSE && __iconified && !__is_binded) { - __change_viewer_visibility(true); - ecore_evas_manual_render_set(ee, EINA_TRUE); - screen_connector_toolkit_evas_send_visibility(__win, - VISIBILITY_TYPE_UNOBSCURED); - __manual_render = true; + __manual_render_start(); __iconified = false; LOGI("Manual render true"); - } else if (ev->iconified == EINA_TRUE){ + } else if (ev->iconified == EINA_TRUE) { __iconified = true; } @@ -246,20 +281,12 @@ static void __screen_connector_toolkit_evas_updated_cb( const char *appid, const char *instance_id, int pid, Evas_Object *image, void *data) { - Evas *evas; - Ecore_Evas *ee; - evas_object_smart_callback_call( __win, WATCH_SMART_SIGNAL_UPDATED, image); - if (__manual_render) { - __manual_render = false; - evas = evas_object_evas_get(__win); - ee = ecore_evas_ecore_evas_get(evas); - ecore_evas_manual_render_set(ee, EINA_FALSE); - LOGI("set manual false"); - } else { + if (__manual_render) + __manual_render_finish(); + else LOGI("updated"); - } } API int watch_manager_set_resource_id(int resource_id) @@ -562,7 +589,7 @@ API int watch_manager_change_auto_visibility(bool enable) return 0; } -static int __change_viewer_visibility(bool visible) +static int __change_viewer_visibility(bool visible, bool update_cur_state) { Evas_Object *watch; int status; @@ -596,18 +623,20 @@ static int __change_viewer_visibility(bool visible) return -1; } _D("send watch control status to %s:%d", __watch_appid, status); + if (update_cur_state) + __viewer_visibility = visible; return 0; } API int watch_manager_notify_resumed_status_of_viewer(void) { - return __change_viewer_visibility(true); + return __change_viewer_visibility(true, true); } API int watch_manager_notify_paused_status_of_viewer(void) { - return __change_viewer_visibility(false); + return __change_viewer_visibility(false, true); } static int __change_visibility(bool visible) -- 2.34.1