Modified window visibility check 84/185184/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 27 Jul 2018 00:24:50 +0000 (09:24 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 27 Jul 2018 00:24:50 +0000 (09:24 +0900)
After this patch is applied, the visibility is managed
in three ways. (NONE, FULLY OBSCUSRED and UNOBSCURED)

Change-Id: I5896c7d8e3fb6f0aed5c725c752ce294615b8a29
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/ui_base/appcore_ui_base.c

index 8b83a1a..b7571c1 100644 (file)
@@ -61,6 +61,12 @@ enum win_status {
        WS_RESUME,
 };
 
+enum visibility_type {
+       VT_NONE,
+       VT_UNOBSCURED,
+       VT_FULLY_OBSCURED,
+};
+
 typedef struct _appcore_ui_base_context {
        appcore_ui_base_ops ops;
        void *data;
@@ -87,7 +93,7 @@ static bool first_launch = true;
 struct win_node {
        unsigned int win;
        unsigned int surf;
-       bool bfobscured;
+       int vis;
 };
 
 static GSList *g_winnode_list;
@@ -380,7 +386,7 @@ static bool __add_win(unsigned int win, unsigned int surf)
 
        t->win = win;
        t->surf = surf;
-       t->bfobscured = FALSE;
+       t->vis = VT_NONE;
 
        g_winnode_list = g_slist_append(g_winnode_list, t);
 
@@ -405,13 +411,13 @@ static bool __delete_win(unsigned int win)
        return TRUE;
 }
 
-static bool __update_win(unsigned int win, unsigned int surf, bool bfobscured)
+static bool __update_win(unsigned int win, unsigned int surf, int vis)
 {
        GSList *f;
        struct win_node *t;
 
-       _DBG("[EVENT_TEST][EVENT] __update_win WIN:%x fully_obscured %d\n", win,
-            bfobscured);
+       _DBG("[EVENT_TEST][EVENT] __update_win WIN:%x visibility %d\n",
+                       win, vis);
 
        f = __find_win(win);
        if (!f) {
@@ -424,7 +430,8 @@ static bool __update_win(unsigned int win, unsigned int surf, bool bfobscured)
        t->win = win;
        if (surf != 0)
                t->surf = surf;
-       t->bfobscured = bfobscured;
+       if (vis != VT_NONE)
+               t->vis = vis;
 
        return TRUE;
 }
@@ -807,12 +814,15 @@ EXPORT_API void appcore_ui_base_window_on_show(int type, void *event)
                return;
        }
 
-       _DBG("[EVENT_TEST][EVENT] GET SHOW EVENT!!!. WIN:%x, %d\n", ev->win, ev->data[0]);
+       _DBG("[EVENT_TEST][EVENT] GET SHOW EVENT!!!. WIN:%x, %d\n",
+                       ev->win, ev->data[0]);
 
-       if (!__find_win((unsigned int)ev->win))
+       if (!__find_win((unsigned int)ev->win)) {
                __add_win((unsigned int)ev->win, (unsigned int)ev->data[0]);
-       else
-               __update_win((unsigned int)ev->win, (unsigned int)ev->data[0], FALSE);
+       } else {
+               __update_win((unsigned int)ev->win, (unsigned int)ev->data[0],
+                               VT_NONE);
+       }
 
        if (ev->data[0] != 0)
                __group_attach();
@@ -827,8 +837,8 @@ static bool __check_visible(void)
 
        for (iter = g_winnode_list; iter != NULL; iter = g_slist_next(iter)) {
                entry = iter->data;
-               _DBG("win : %x obscured : %d\n", entry->win, entry->bfobscured);
-               if (entry->bfobscured == FALSE)
+               _DBG("win : %x visibility : %d\n", entry->win, entry->vis);
+               if (entry->vis == VT_UNOBSCURED)
                        return true;
        }
 
@@ -871,7 +881,8 @@ EXPORT_API void appcore_ui_base_window_on_visibility(int type, void *event)
        int bvisibility;
 
        ev = event;
-       __update_win((unsigned int)ev->win, 0, ev->fully_obscured);
+       __update_win((unsigned int)ev->win, 0,
+                       ev->fully_obscured ? VT_FULLY_OBSCURED : VT_UNOBSCURED);
        bvisibility = __check_visible();
 
        _DBG("bvisibility %d, w_status %d", bvisibility, w_status);
@@ -903,7 +914,7 @@ EXPORT_API void appcore_ui_base_window_on_pre_visibility(int type, void *event)
        bool bvisibility;
 
        if (ev && ev->type == ECORE_WL2_WINDOW_VISIBILITY_TYPE_PRE_UNOBSCURED) {
-               __update_win((unsigned int)ev->win, 0, false);
+               __update_win((unsigned int)ev->win, 0, VT_UNOBSCURED);
                bvisibility = __check_visible();
 
                _DBG("bvisibility %d, w_status %d", bvisibility, w_status);