e_comp: remove the use of ec->zone 89/295389/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 5 Jul 2023 01:50:14 +0000 (10:50 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 6 Jul 2023 08:50:48 +0000 (17:50 +0900)
The zone variable of ec will be deprecated.

Change-Id: I13e745101462ce73d995f9f13866a22bfee64fd7

12 files changed:
src/bin/e_comp.c
src/bin/e_comp_canvas.c
src/bin/e_comp_screen.c
src/bin/e_comp_wl.c
src/bin/e_comp_wl_tizen_hwc.c
src/bin/e_hwc_planes.c
src/bin/e_info_server.c
src/bin/e_magnifier.c
src/bin/e_main.c
src/bin/e_maximize.c
src/bin/e_plane.c
src/bin/e_pointer.c

index 6ddb9ee..65bf02b 100644 (file)
@@ -921,12 +921,14 @@ e_comp_is_on_overlay(E_Client *ec)
    E_Output *eout;
    E_Plane *ep;
    E_Hwc_Window *hwc_window;
+   E_Zone *zone;
 
    EINA_SAFETY_ON_TRUE_RETURN_VAL(!ec, EINA_FALSE);
-   EINA_SAFETY_ON_TRUE_RETURN_VAL(!ec->zone, EINA_FALSE);
-   EINA_SAFETY_ON_TRUE_RETURN_VAL(!ec->zone->output_id, EINA_FALSE);
+   zone = e_comp_zone_find_by_ec(ec);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(!zone, EINA_FALSE);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(!zone->output_id, EINA_FALSE);
 
-   eout = e_output_find(ec->zone->output_id);
+   eout = e_output_find(zone->output_id);
    if (!eout) return EINA_FALSE;
 
    if (e_hwc_policy_get(eout->hwc) == E_HWC_POLICY_PLANES)
@@ -989,7 +991,7 @@ e_comp_vis_ec_list_get(E_Zone *zone)
         if (!ec) continue;
         if (e_object_is_del(E_OBJECT(ec))) continue;
 
-        if (ec->zone != zone) continue;
+        if (e_comp_zone_find_by_ec(ec) != zone) continue;
 
         // check clients to skip composite
         if (e_client_util_ignored_get(ec) || (!evas_object_visible_get(ec->frame)))
@@ -1352,7 +1354,7 @@ e_comp_hwc_client_end(E_Client *ec, const char *location)
 
    EINA_SAFETY_ON_NULL_RETURN(ec);
 
-   zone = ec->zone;
+   zone = e_comp_zone_find_by_ec(ec);
    EINA_SAFETY_ON_NULL_RETURN(zone);
 
    output = e_output_find(zone->output_id);
index 5607957..a8e88e3 100644 (file)
@@ -410,7 +410,7 @@ e_comp_canvas_update(void)
                   printf("reassign all clients from deleted zone %p\n", zone);
                   E_CLIENT_FOREACH(ec)
                     {
-                       if (ec->zone == zone)
+                       if (e_comp_zone_find_by_ec(ec) == zone)
                          {
                             if (spare_zone)
                               e_client_zone_set(ec, spare_zone);
index b888c5f..7affba2 100644 (file)
@@ -94,7 +94,7 @@ _tz_screen_rotation_get_ignore_output_transform(struct wl_client *client, struct
 
    tzsr_list = eina_list_append(tzsr_list, tzsr);
 
-   zone = ec->zone;
+   zone = e_comp_zone_find_by_ec(ec);
    if (zone)
      {
         output = e_output_find(zone->output_id);
index b929185..0574acd 100644 (file)
@@ -2768,6 +2768,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
    Eina_List *l, *ll;
    E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
    E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport;
+   E_Zone *zone;
 
    if (ec->ignored)
      {
@@ -2798,9 +2799,12 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
         if (transform_change == vp->wait_for_transform_change)
           vp->wait_for_transform_change = 0;
 
-        if (ec->zone)
+        // TODO: This logic has to move to e_comp_hwc or e_hwc_window and it is
+        //       triggered by E_CLIENT_HOOK calls at those file.
+        zone = e_comp_zone_find_by_ec(ec);
+        if (zone)
           {
-             eout = e_output_find(ec->zone->output_id);
+             eout = e_output_find(zone->output_id);
              if (eout && eout->hwc)
                {
                   if (e_hwc_policy_get(eout->hwc) == E_HWC_POLICY_PLANES)
index 9960384..fe46047 100644 (file)
@@ -66,11 +66,14 @@ static E_Hwc *
 _e_comp_wl_tizen_hwc_client_hwc_get(E_Client *ec)
 {
    E_Output *output;
+   E_Zone *zone;
 
    if (!ec) return NULL;
-   if (!ec->zone) return NULL;
 
-   output = e_output_find(ec->zone->output_id);
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return NULL;
+
+   output = e_output_find(zone->output_id);
    if (!output) return NULL;
 
    return output->hwc;
index 6a3f013..c008655 100644 (file)
@@ -20,6 +20,7 @@ _e_hwc_planes_ec_check(E_Client *ec)
 {
    E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
    E_Output *eout;
+   E_Zone *zone;
    int minw = 0, minh = 0;
    int transform;
 
@@ -51,7 +52,10 @@ _e_hwc_planes_ec_check(E_Client *ec)
          return EINA_FALSE;
      }
 
-   eout = e_output_find(ec->zone->output_id);
+   zone = e_comp_zone_find_by_ec(ec);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
+
+   eout = e_output_find(zone->output_id);
    EINA_SAFETY_ON_NULL_RETURN_VAL(eout, EINA_FALSE);
 
    tdm_output_get_available_size(eout->toutput, &minw, &minh, NULL, NULL, NULL);
index 90cdc53..1d8a226 100644 (file)
@@ -190,6 +190,7 @@ _e_info_server_ec_hwc_info_get(E_Client *ec, int *hwc, int *hwc_policy, int *pl_
 {
    Eina_List *l;
    E_Output *eout;
+   E_Zone *zone;
    E_Plane *ep;
    E_Hwc_Window *hwc_window = NULL;
 
@@ -201,7 +202,9 @@ _e_info_server_ec_hwc_info_get(E_Client *ec, int *hwc, int *hwc_policy, int *pl_
 
    *hwc = 0;
 
-   eout = e_output_find(ec->zone->output_id);
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
+   eout = e_output_find(zone->output_id);
    if (!eout) return;
 
    *hwc_policy = e_hwc_policy_get(eout->hwc);
@@ -301,6 +304,7 @@ _msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
         int x = 0, y = 0, w = 0, h = 0;
         int zone_id = -1;
         E_Iconified_Type iconified_type;
+        E_Zone *zone;
 
         if (is_visible && e_client_util_ignored_get(ec)) continue;
 
@@ -351,8 +355,9 @@ _msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
 
         transformed = e_client_transform_core_enable_get(ec);
 
-        if (ec->zone)
-          zone_id = ec->zone->id;
+        zone = e_comp_zone_find_by_ec(ec);
+        if (zone)
+          zone_id = zone->id;
 
         eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
 
@@ -399,6 +404,7 @@ _msg_clients_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
         Eina_Bool transformed = EINA_FALSE;
         int zone_id = -1;
         E_Iconified_Type iconified_type;
+        E_Zone *zone;
 
         ec = evas_object_data_get(o, "E_Client");
         if (!ec) continue;
@@ -450,8 +456,9 @@ _msg_clients_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
 
         transformed = e_client_transform_core_enable_get(ec);
 
-        if (ec->zone)
-          zone_id = ec->zone->id;
+        zone = e_comp_zone_find_by_ec(ec);
+        if (zone)
+          zone_id = zone->id;
 
         eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
 
index 0b83e8a..cd6b44a 100644 (file)
@@ -790,16 +790,20 @@ e_magnifier_zoom_obj_geometry_set(E_Client *ec, int angle, int x, int y, int w,
      }
 
    E_Desk *desk = NULL;
+   E_Zone *zone;
    int tx, ty, tw, th;
 
-   tx = ec->zone->x;
-   ty = ec->zone->y;
-   tw = ec->zone->w;
-   th = ec->zone->h;
+   zone = e_comp_zone_find_by_ec(ec);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
+
+   tx = zone->x;
+   ty = zone->y;
+   tw = zone->w;
+   th = zone->h;
 
    if (e_config->use_desk_smart_obj)
      {
-        desk = e_desk_current_get(ec->zone);
+        desk = e_desk_current_get(zone);
         if (desk)
           {
              tx = desk->geom.x;
index e6ad6c0..2e4a0d7 100644 (file)
@@ -1145,13 +1145,17 @@ static void
 _e_main_desk_restore(void)
 {
    E_Client *ec;
+   E_Zone *zone;
 
    E_CLIENT_REVERSE_FOREACH(ec)
-     if ((!e_client_util_ignored_get(ec)) && e_client_util_desk_visible(ec, e_desk_current_get(ec->zone)))
-       {
-          ec->want_focus = ec->take_focus = 1;
-          break;
-       }
+     {
+        zone = e_comp_zone_find_by_ec(ec);
+        if ((!e_client_util_ignored_get(ec)) && e_client_util_desk_visible(ec, e_desk_current_get(zone)))
+          {
+             ec->want_focus = ec->take_focus = 1;
+             break;
+          }
+     }
 }
 
 static Eina_Bool
index b3c1f51..91f3d21 100644 (file)
@@ -30,18 +30,22 @@ EINTERN void
 e_maximize_client_dock_fit(E_Client *ec, int *x1, int *yy1, int *x2, int *y2)
 {
    E_Client *ec2;
+   E_Zone *zone, *ec2_zone;
    int cx1, cx2, cy1, cy2;
 
-   cx1 = ec->zone->x;
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
+
+   cx1 = zone->x;
    if (x1) cx1 = *x1;
 
-   cy1 = ec->zone->y;
+   cy1 = zone->y;
    if (yy1) cy1 = *yy1;
 
-   cx2 = ec->zone->x + ec->zone->w;
+   cx2 = zone->x + zone->w;
    if (x2) cx2 = *x2;
 
-   cy2 = ec->zone->y + ec->zone->h;
+   cy2 = zone->y + zone->h;
    if (y2) cy2 = *y2;
 
    E_CLIENT_FOREACH(ec2)
@@ -55,38 +59,39 @@ e_maximize_client_dock_fit(E_Client *ec, int *x1, int *yy1, int *x2, int *y2)
            LEFT
         } edge = NONE;
 
-        if ((ec2->zone != ec->zone) || (ec2 == ec) ||
+        ec2_zone = e_comp_zone_find_by_ec(ec2);
+        if ((ec2_zone != zone) || (ec2 == ec) ||
             (ec2->netwm.type != E_WINDOW_TYPE_DOCK))
           continue;
 
-        if (((ec2->x == ec2->zone->x) || ((ec2->x + ec2->w) == (ec2->zone->x + ec2->zone->w))) &&
-            ((ec2->y == ec2->zone->y) || ((ec2->x + ec2->h) == (ec2->zone->x + ec2->zone->h))))
+        if (((ec2->x == ec2_zone->x) || ((ec2->x + ec2->w) == (ec2_zone->x + ec2_zone->w))) &&
+            ((ec2->y == ec2_zone->y) || ((ec2->x + ec2->h) == (ec2_zone->x + ec2_zone->h))))
           {
              /* corner */
              if (ec2->w > ec2->h)
                {
-                  if (ec2->y == ec2->zone->y)
+                  if (ec2->y == ec2_zone->y)
                     edge = TOP;
-                  else if ((ec2->y + ec2->h) == (ec2->zone->y + ec2->zone->h))
+                  else if ((ec2->y + ec2->h) == (ec2_zone->y + ec2_zone->h))
                     edge = BOTTOM;
                }
              else
                {
-                  if ((ec2->x + ec2->w) == (ec2->zone->x + ec2->zone->w))
+                  if ((ec2->x + ec2->w) == (ec2_zone->x + ec2_zone->w))
                     edge = RIGHT;
-                  else if (ec2->x == ec2->zone->x)
+                  else if (ec2->x == ec2_zone->x)
                     edge = LEFT;
                }
           }
         else
           {
-             if (ec2->y == ec2->zone->y)
+             if (ec2->y == ec2_zone->y)
                edge = TOP;
-             else if ((ec2->y + ec2->h) == (ec2->zone->y + ec2->zone->h))
+             else if ((ec2->y + ec2->h) == (ec2_zone->y + ec2_zone->h))
                edge = BOTTOM;
-             else if (ec2->x == ec2->zone->x)
+             else if (ec2->x == ec2_zone->x)
                edge = LEFT;
-             else if ((ec2->x + ec2->w) == (ec2->zone->x + ec2->zone->w))
+             else if ((ec2->x + ec2->w) == (ec2_zone->x + ec2_zone->w))
                edge = RIGHT;
           }
 
@@ -137,10 +142,15 @@ e_maximize_client_client_fill(E_Client *ec, int *x1, int *yy1, int *x2, int *y2,
    Eina_List *rects = NULL;
    E_Maximize_Rect *r;
    E_Client *ec2;
+   E_Zone *zone, *ec2_zone;
+
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
 
    E_CLIENT_FOREACH(ec2)
      {
-        if ((ec2->zone != ec->zone) || (ec == ec2) || (ec2->desk != ec->desk && !ec2->sticky) || (ec2->iconic))
+        ec2_zone = e_comp_zone_find_by_ec(ec2);
+        if ((ec2_zone != zone) || (ec == ec2) || (ec2->desk != ec->desk && !ec2->sticky) || (ec2->iconic))
           continue;
         OBSTACLE(ec2->x, ec2->y, ec2->x + ec2->w, ec2->y + ec2->h);
      }
@@ -161,11 +171,15 @@ _e_maximize_client_rects_fill(E_Client *ec, Eina_List *rects, int *x1, int *yy1,
    else
      {
         int bx, by, bw, bh;
+        E_Zone *zone;
+
+        zone = e_comp_zone_find_by_ec(ec);
+        if (!zone) return;
 
-        bx = E_CLAMP(ec->x, ec->zone->x, ec->zone->x + ec->zone->w);
-        by = E_CLAMP(ec->y, ec->zone->y, ec->zone->y + ec->zone->h);
-        bw = E_CLAMP(ec->w, 0, ec->zone->w);
-        bh = E_CLAMP(ec->h, 0, ec->zone->h);
+        bx = E_CLAMP(ec->x, zone->x, zone->x + zone->w);
+        by = E_CLAMP(ec->y, zone->y, zone->y + zone->h);
+        bw = E_CLAMP(ec->w, 0, zone->w);
+        bh = E_CLAMP(ec->h, 0, zone->h);
 
         if ((dir & E_MAXIMIZE_DIRECTION) == E_MAXIMIZE_HORIZONTAL)
           _e_maximize_client_rects_fill_horiz(ec, rects, x1, x2, &bx, &by, &bw, &bh);
@@ -182,17 +196,21 @@ _e_maximize_client_rects_fill_both(E_Client *ec, Eina_List *rects, int *x1, int
    int hx1, hy1, hx2, hy2;
    int vx1, vy1, vx2, vy2;
    int bx, by, bw, bh;
+   E_Zone *zone;
 
-   hx1 = vx1 = ec->zone->x;
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
+
+   hx1 = vx1 = zone->x;
    if (x1) hx1 = vx1 = *x1;
 
-   hy1 = vy1 = ec->zone->y;
+   hy1 = vy1 = zone->y;
    if (yy1) hy1 = vy1 = *yy1;
 
-   hx2 = vx2 = ec->zone->x + ec->zone->w;
+   hx2 = vx2 = zone->x + zone->w;
    if (x2) hx2 = vx2 = *x2;
 
-   hy2 = vy2 = ec->zone->y + ec->zone->h;
+   hy2 = vy2 = zone->y + zone->h;
    if (y2) hy2 = vy2 = *y2;
 
    /* Init working values, try maximizing horizontally first */
@@ -234,18 +252,22 @@ _e_maximize_client_rects_fill_horiz(E_Client *ec, Eina_List *rects, int *x1, int
    Eina_List *l;
    E_Maximize_Rect *rect;
    int cx1, cx2;
+   E_Zone *zone;
+
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
 
-   cx1 = ec->zone->x;
+   cx1 = zone->x;
    if (x1) cx1 = *x1;
 
-   cx2 = ec->zone->x + ec->zone->w;
+   cx2 = zone->x + zone->w;
    if (x2) cx2 = *x2;
 
    /* Expand left */
    EINA_LIST_FOREACH(rects, l, rect)
      {
         if ((rect->x2 > cx1) && (rect->x2 <= *bx) &&
-            E_INTERSECTS(0, rect->yy1, ec->zone->w, (rect->y2 - rect->yy1), 0, *by, ec->zone->w, *bh))
+            E_INTERSECTS(0, rect->yy1, zone->w, (rect->y2 - rect->yy1), 0, *by, zone->w, *bh))
           {
              cx1 = rect->x2;
           }
@@ -257,7 +279,7 @@ _e_maximize_client_rects_fill_horiz(E_Client *ec, Eina_List *rects, int *x1, int
    EINA_LIST_FOREACH(rects, l, rect)
      {
         if ((rect->x1 < cx2) && (rect->x1 >= (*bx + *bw)) &&
-            E_INTERSECTS(0, rect->yy1, ec->zone->w, (rect->y2 - rect->yy1), 0, *by, ec->zone->w, *bh))
+            E_INTERSECTS(0, rect->yy1, zone->w, (rect->y2 - rect->yy1), 0, *by, zone->w, *bh))
           {
              cx2 = rect->x1;
           }
@@ -274,18 +296,22 @@ _e_maximize_client_rects_fill_vert(E_Client *ec, Eina_List *rects, int *yy1, int
    Eina_List *l;
    E_Maximize_Rect *rect;
    int cy1, cy2;
+   E_Zone *zone;
+
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
 
-   cy1 = ec->zone->y;
+   cy1 = zone->y;
    if (yy1) cy1 = *yy1;
 
-   cy2 = ec->zone->y + ec->zone->h;
+   cy2 = zone->y + zone->h;
    if (y2) cy2 = *y2;
 
    /* Expand up */
    EINA_LIST_FOREACH(rects, l, rect)
      {
         if ((rect->y2 > cy1) && ((rect->yy1 <= *by) || (rect->y2 <= *by)) &&
-            E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), ec->zone->h, *bx, 0, *bw, ec->zone->h))
+            E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), zone->h, *bx, 0, *bw, zone->h))
           {
              cy1 = rect->y2;
           }
@@ -297,7 +323,7 @@ _e_maximize_client_rects_fill_vert(E_Client *ec, Eina_List *rects, int *yy1, int
    EINA_LIST_FOREACH(rects, l, rect)
      {
         if ((rect->yy1 < cy2) && (rect->yy1 >= (*by + *bh)) &&
-            E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), ec->zone->h, *bx, 0, *bw, ec->zone->h))
+            E_INTERSECTS(rect->x1, 0, (rect->x2 - rect->x1), zone->h, *bx, 0, *bw, zone->h))
           {
              cy2 = rect->yy1;
           }
index acd4981..d4cd82c 100644 (file)
@@ -332,6 +332,7 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
    tdm_error error;
    tdm_layer *tlayer = plane->tlayer;
    E_Output *output = plane->output;
+   E_Zone *zone;
    E_Client *ec = plane->ec;
    unsigned int aligned_width;
    int dst_x, dst_y, dst_w, dst_h;
@@ -371,8 +372,11 @@ _e_plane_surface_set(E_Plane *plane, tbm_surface_h tsurface)
         if (output->config.rotation > 0)
           {
              int bw, bh;
+             zone = e_comp_zone_find_by_ec(ec);
+             if (!zone) return EINA_FALSE;
+
              e_pixmap_size_get(ec->pixmap, &bw, &bh);
-             e_comp_wl_rect_convert(ec->zone->w, ec->zone->h,
+             e_comp_wl_rect_convert(zone->w, zone->h,
                                     output->config.rotation / 90, 1,
                                     dst_x, dst_y, bw, bh,
                                     &dst_x, &dst_y, NULL, NULL);
index 04146e4..9f20946 100644 (file)
@@ -18,6 +18,7 @@ static void
 _e_pointer_configured_output_resolution_ratio_get(E_Client *ec, double *ratio_w, double *ratio_h)
 {
    E_Output *output;
+   E_Zone *zone;
 
    if (ratio_w) *ratio_w = 1.0;
    if (ratio_h) *ratio_h = 1.0;
@@ -27,9 +28,11 @@ _e_pointer_configured_output_resolution_ratio_get(E_Client *ec, double *ratio_w,
    if (e_config->cursor_configured_output_resolution.h == 0) return;
 
    if (!ec) return;
-   if (!ec->zone) return;
 
-   output = e_output_find(ec->zone->output_id);
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
+
+   output = e_output_find(zone->output_id);
    if (!output) return;
    if (output->config.geom.w == 0) return;
    if (output->config.geom.h == 0) return;