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;
}