From: Hwankyu Jhun Date: Tue, 7 Nov 2017 00:58:55 +0000 (+0900) Subject: Fix visibility handling X-Git-Tag: accepted/tizen/4.0/unified/20171110.071334~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fapp-core.git;a=commitdiff_plain;h=41bf3609ea42c64ca2ccd0819d04136b9f306f88 Fix visibility handling When this patch is applied, the active state of the app is managed in three ways. (NONE, PAUSE and RESUME) This patch is for backward compatibility. In tizen 2.x, the state is managed in three ways. (-1, 0 and 1) Change-Id: I4f4cdf32bb26b854fd778a4dca09eae8a7ce2ec4 Signed-off-by: Hwankyu Jhun --- diff --git a/src/ui_base/appcore_ui_base.c b/src/ui_base/appcore_ui_base.c index 90d85a0..102345e 100644 --- a/src/ui_base/appcore_ui_base.c +++ b/src/ui_base/appcore_ui_base.c @@ -55,6 +55,12 @@ enum app_state { AS_DYING, }; +enum win_status { + WS_NONE, + WS_PAUSE, + WS_RESUME, +}; + typedef struct _appcore_ui_base_context { appcore_ui_base_ops ops; void *data; @@ -74,7 +80,7 @@ typedef struct _appcore_ui_base_context { } appcore_ui_base_context; -static bool b_active = false; +static int w_status = WS_NONE; static bool first_launch = true; struct win_node { @@ -831,9 +837,9 @@ EXPORT_API void appcore_ui_base_window_on_hide(int type, void *event) if (__find_win((unsigned int)ev->win)) { __delete_win((unsigned int)ev->win); bvisibility = __check_visible(); - if (!bvisibility && b_active == TRUE) { + if (!bvisibility && w_status != WS_PAUSE) { _DBG(" Go to Pasue state \n"); - b_active = FALSE; + w_status = WS_PAUSE; __do_pause(); } } @@ -859,15 +865,15 @@ EXPORT_API void appcore_ui_base_window_on_visibility(int type, void *event) __update_win((unsigned int)ev->win, 0, ev->fully_obscured); bvisibility = __check_visible(); - _DBG("bvisibility %d, b_active %d", bvisibility, b_active); + _DBG("bvisibility %d, w_status %d", bvisibility, w_status); - if (bvisibility && b_active == FALSE) { + if (bvisibility && w_status != WS_RESUME) { _DBG(" Go to Resume state\n"); - b_active = TRUE; + w_status = WS_RESUME; __do_resume(); - } else if (!bvisibility && b_active == TRUE) { + } else if (!bvisibility && w_status != WS_PAUSE) { _DBG(" Go to Pasue state \n"); - b_active = FALSE; + w_status = WS_PAUSE; __do_pause(); } else { _DBG(" No change state \n"); @@ -884,10 +890,10 @@ EXPORT_API void appcore_ui_base_window_on_pre_visibility(int type, void *event) __update_win((unsigned int)ev->win, 0, false); bvisibility = __check_visible(); - _DBG("bvisibility %d, b_active %d", bvisibility, b_active); - if (bvisibility && b_active == FALSE) { + _DBG("bvisibility %d, w_status %d", bvisibility, w_status); + if (bvisibility && w_status != WS_RESUME) { _DBG(" Go to Resume state\n"); - b_active = TRUE; + w_status = WS_RESUME; __do_resume(); } }