Fix visibility handling
[platform/core/appfw/app-core.git] / src / ui_base / appcore_ui_base.c
index 90d85a0..102345e 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();
                }
        }