e_mod_rotation_wl: use e_client_below_get instead of direct access to e_comp->layers 35/307235/1
authorJunseok Kim <juns.kim@samsung.com>
Wed, 6 Mar 2024 07:45:56 +0000 (16:45 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Wed, 6 Mar 2024 07:45:56 +0000 (16:45 +0900)
Change-Id: I081e40dfa11f413bf402a45453bb1f8cf31a6631

src/rotation/e_mod_rotation_wl.c

index 5cddeb9..52e43ec 100644 (file)
@@ -1764,51 +1764,18 @@ e_client_rotation_next_angle_get(E_Client *ec)
 static E_Client *
 e_client_rotation_find_below(E_Client *ec)
 {
-   unsigned int x;
-   E_Client *ec2;
-   Eina_Inlist *l;
+   E_Client *below_ec = NULL;
+
+   for (below_ec = e_client_below_get(ec);
+        below_ec;
+        below_ec = e_client_below_get(ec))
+      {
+         if ((below_ec->comp_data && below_ec->comp_data->mapped) &&
+             (!e_client_util_ignored_get(below_ec)) &&
+             (!e_client_is_iconified_by_client(below_ec)))
+           return below_ec;
+      }
 
-   E_OBJECT_CHECK_RETURN(ec, NULL);
-   E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, NULL);
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
-   if (EINA_INLIST_GET(ec)->prev) //check current layer
-     {
-        for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
-          {
-             ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
-
-             if ((ec2->comp_data && ec2->comp_data->mapped) &&
-                 (!e_object_is_del(E_OBJECT(ec2))) &&
-                 (!e_client_util_ignored_get(ec2)) &&
-                 (!e_client_is_iconified_by_client(ec2)))
-               return ec2;
-          }
-     }
-
-   /* go down the layers until we find one */
-   if (e_comp_canvas_layer_map(ec->layer) > e_comp_canvas_layer_map(E_LAYER_MAX)) return NULL;
-   x = e_comp_canvas_layer_map(ec->layer);
-   if (x > 0) x--;
-
-   for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
-     {
-        if (e_comp->layers[x].clients)
-          {
-             EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2)
-               {
-                  if (ec2 == ec) continue;
-                  if ((ec2->comp_data && ec2->comp_data->mapped) &&
-                      (!e_object_is_del(E_OBJECT(ec2))) &&
-                      (!e_client_util_ignored_get(ec2)) &&
-                      (!e_client_is_iconified_by_client(ec2)))
-                    return ec2;
-               }
-          }
-
-        if (x == 0)
-          break;
-     }
    return NULL;
 }