e_policy_visibility: get below activity clients with eina_tiler 97/229197/2 accepted/tizen/unified/20200403.153121 submit/tizen/20200403.093600
authorJunseok, Kim <juns.kim@samsung.com>
Mon, 30 Mar 2020 07:36:38 +0000 (16:36 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 3 Apr 2020 09:25:07 +0000 (09:25 +0000)
Change-Id: I1e8d2c068f73dd0ade25afe57a673377af00f1bd

src/bin/e_policy_visibility.c

index 365108886dec84cdbb07c3ffc2e76d8f2c47102d..3e2981ec11d68810389848e29cba6285e85b6f60 100644 (file)
@@ -1717,14 +1717,76 @@ _e_vis_ec_above_visible_type(E_Client *ec, Eina_Bool check_child)
    return above_vis_type;
 }
 
+static Eina_Bool
+_e_vis_client_check_obscure_below(E_Client *ec)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
+
+   if (e_client_util_ignored_get(ec)) return EINA_FALSE;
+   if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
+   if (ec->iconic && ec->exp_iconify.by_client) return EINA_FALSE;
+   if (ec->bg_state) return EINA_FALSE;
+   if (ec->comp_data && !ec->comp_data->mapped) return EINA_FALSE;
+   if (!(ec->argb) || !(ec->visibility.opaque <= 0)) return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
 static void
 _e_vis_ec_below_activity_clients_get(E_Client *ec, Eina_List **below_list)
 {
    E_Client *below;
+   E_Client *above;
+   Eina_Tiler *above_tile = NULL;
+   Eina_Tiler *below_tile = NULL;
+   Eina_Tiler *temp_tile = NULL;
+   Eina_Rectangle r;
+   Eina_Rectangle desk_rect;
+   int x, y, w, h;
+
+   EINA_RECTANGLE_SET(&desk_rect, ec->desk->geom.x, ec->desk->geom.y, ec->desk->geom.w, ec->desk->geom.h);
+
+   above_tile = eina_tiler_new(ec->desk->geom.w, ec->desk->geom.h);
+   EINA_SAFETY_ON_NULL_GOTO(above_tile, finish);
+   below_tile = eina_tiler_new(ec->desk->geom.w, ec->desk->geom.h);
+   EINA_SAFETY_ON_NULL_GOTO(below_tile, finish);
+   temp_tile = eina_tiler_new(ec->desk->geom.w, ec->desk->geom.h);
+   EINA_SAFETY_ON_NULL_GOTO(temp_tile, finish);
+
+   eina_tiler_tile_size_set(above_tile, 1, 1);
+   eina_tiler_tile_size_set(below_tile, 1, 1);
+   eina_tiler_tile_size_set(temp_tile, 1, 1);
+
+   for (above = e_client_above_get(ec); above; above = e_client_above_get(above))
+     {
+        if (_e_vis_client_check_obscure_below(above))
+          {
+             e_client_geometry_get(above, &x, &y, &w, &h);
+             EINA_RECTANGLE_SET(&r, x, y, w, h);
+             eina_tiler_rect_add(above_tile, &r);
+          }
+     }
+
+   // if fully obscured by aboves, no need to get below list
+   eina_tiler_rect_add(temp_tile, &desk_rect);
+   eina_tiler_subtract(temp_tile, above_tile);
+   if (eina_tiler_empty(temp_tile))
+     goto finish;
 
    for (below = e_client_below_get(ec); below; below = e_client_below_get(below))
      {
         if (!_e_vis_ec_activity_check(below, EINA_FALSE, EINA_FALSE)) continue;
+        e_client_geometry_get(below, &x, &y, &w, &h);
+        EINA_RECTANGLE_SET(&r, x, y, w, h);
+        eina_tiler_rect_add(below_tile, &r);
+
+        // get unobscured region of below ec
+        eina_tiler_clear(temp_tile);
+        eina_tiler_union(temp_tile, above_tile);
+        eina_tiler_union(temp_tile, below_tile);
+        eina_tiler_subtract(temp_tile, above_tile);
+
+        if (eina_tiler_empty(temp_tile)) continue;
 
         E_VIS_CLIENT_GET(vc, below);
         if (!vc) continue;
@@ -1734,11 +1796,27 @@ _e_vis_ec_below_activity_clients_get(E_Client *ec, Eina_List **below_list)
           continue;
 
         *below_list = eina_list_prepend(*below_list, vc);
-        if ((below->argb) && (below->visibility.opaque <= 0))
-          continue;
-        else
-          break;
+        if (!(below->argb) || !(below->visibility.opaque <= 0))
+          {
+             eina_tiler_union(above_tile, below_tile);
+
+             // if fully obscured by aboves, no need to continue
+             eina_tiler_rect_add(temp_tile, &desk_rect);
+             eina_tiler_subtract(temp_tile, above_tile);
+             if (eina_tiler_empty(temp_tile))
+               break;
+          }
      }
+
+finish:
+   if (above_tile)
+     eina_tiler_free(above_tile);
+
+   if (below_tile)
+     eina_tiler_free(below_tile);
+
+   if (temp_tile)
+     eina_tiler_free(temp_tile);
 }
 
 static Eina_Bool