Fix visibility handling 64/159064/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 7 Nov 2017 00:58:55 +0000 (09:58 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 7 Nov 2017 03:15:46 +0000 (03:15 +0000)
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 <h.jhun@samsung.com>
src/ui_base/appcore_ui_base.c

index 90d85a067d60ff5bfbd69404ec5af6d024b71bf3..102345ebc76bd4f965f62d9e5f596172543f4622 100644 (file)
@@ -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();
                }
        }