return reply;
}
+static void
+_msg_ec_append(Eldbus_Message_Iter *struct_of_ec, E_Client *ec)
+{
+ Ecore_Window win;
+ Ecore_Window pwin;
+ uint32_t res_id = 0;
+ pid_t pid = -1;
+ char layer_name[128] = {0,};
+ int hwc = -1, hwc_policy = E_HWC_POLICY_NONE, pl_zpos = -999;
+ int iconified = 0;
+ Eina_Bool has_input_region = EINA_FALSE;
+ Eina_List *list_input_region = NULL;
+ Eina_Bool mapped = EINA_FALSE;
+ Eina_Bool transformed = EINA_FALSE;
+ int x = 0, y = 0, w = 0, h = 0;
+ int zone_id = -1;
+ int desk_id_x = -1, desk_id_y = -1;
+ int desk_area_id = -1;
+ E_Iconified_Type iconified_type;
+ E_Zone *zone;
+ E_Desk *desk;
+ E_Desk_Area *eda;
+
+ win = e_client_util_win_get(ec);
+ e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name));
+
+ pwin = e_client_util_win_get(ec->parent);
+
+ if (ec->pixmap)
+ res_id = e_pixmap_res_id_get(ec->pixmap);
+
+ pid = ec->netwm.pid;
+ if (pid <= 0)
+ {
+ if (ec->comp_data)
+ {
+ E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
+ if (cdata->surface)
+ wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
+ }
+ }
+
+ if (ec->iconic)
+ {
+ iconified_type = e_client_iconified_type_get(ec);
+ if (iconified_type == 0)
+ {
+ // if iconified_type is 0, then there is code not to set iconify_type
+ // before calling e_client_iconify. We have to find and fix it.
+ iconified = -1;
+ }
+ else
+ iconified = iconified_type;
+ }
+ else
+ iconified = 0;
+
+ if (ec->comp_data)
+ mapped = ec->comp_data->mapped;
+
+ _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos);
+
+ e_comp_object_input_rect_get(ec->frame, &list_input_region);
+ if (list_input_region)
+ {
+ has_input_region = EINA_TRUE;
+ list_input_region = eina_list_free(list_input_region);
+ }
+ e_client_geometry_get(ec, &x, &y, &w, &h);
+
+ transformed = e_client_transform_core_enable_get(ec);
+
+ zone = e_comp_zone_find_by_ec(ec);
+ if (zone)
+ zone_id = zone->id;
+
+ desk = e_zone_desk_find_by_ec(zone, ec);
+ if (desk)
+ {
+ desk_id_x = desk->x;
+ desk_id_y = desk->y;
+ }
+
+ eda = e_desk_desk_area_find_by_ec(desk, ec);
+ if (eda)
+ {
+ desk_area_id = eda->id;
+ }
+
+ eldbus_message_iter_arguments_append
+ (struct_of_ec, VALUE_TYPE_FOR_TOPVWINS,
+ win,
+ res_id,
+ pid,
+ e_client_util_name_get(ec) ?: "NO NAME",
+ x, y, w, h, ec->layer,
+ ec->visible, mapped, ec->argb, ec->visibility.opaque, e_client_visibility_get(ec), ec->visibility.force_obscured, iconified,
+ evas_object_visible_get(ec->frame), ec->focused, hwc, hwc_policy, pl_zpos, pwin, layer_name, has_input_region, transformed, ec->transient_policy,
+ zone_id, desk_id_x, desk_id_y, desk_area_id, e_client_is_layout_apply(ec));
+
+ return;
+}
+
static void
_msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
{
E_CLIENT_REVERSE_FOREACH(ec)
{
Eldbus_Message_Iter* struct_of_ec;
- Ecore_Window win;
- Ecore_Window pwin;
- uint32_t res_id = 0;
- pid_t pid = -1;
- char layer_name[128] = {0,};
- int hwc = -1, hwc_policy = E_HWC_POLICY_NONE, pl_zpos = -999;
- int iconified = 0;
- Eina_Bool has_input_region = EINA_FALSE;
- Eina_List *list_input_region = NULL;
- Eina_Bool mapped = EINA_FALSE;
- Eina_Bool transformed = EINA_FALSE;
- int x = 0, y = 0, w = 0, h = 0;
- int zone_id = -1;
- int desk_id_x = -1, desk_id_y = -1;
- int desk_area_id = -1;
- E_Iconified_Type iconified_type;
- E_Zone *zone;
- E_Desk *desk;
- E_Desk_Area *eda;
if (is_visible && e_client_util_ignored_get(ec)) continue;
- win = e_client_util_win_get(ec);
- e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name));
-
- pwin = e_client_util_win_get(ec->parent);
-
- if (ec->pixmap)
- res_id = e_pixmap_res_id_get(ec->pixmap);
-
- pid = ec->netwm.pid;
- if (pid <= 0)
- {
- if (ec->comp_data)
- {
- E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
- if (cdata->surface)
- wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
- }
- }
+ eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
+ _msg_ec_append(struct_of_ec, ec);
+ eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
+ }
- if (ec->iconic)
- {
- iconified_type = e_client_iconified_type_get(ec);
- if (iconified_type == 0)
- {
- // if iconified_type is 0, then there is code not to set iconify_type
- // before calling e_client_iconify. We have to find and fix it.
- iconified = -1;
- }
- else
- iconified = iconified_type;
- }
- else
- iconified = 0;
+ eldbus_message_iter_container_close(iter, array_of_ec);
+}
- if (ec->comp_data)
- mapped = ec->comp_data->mapped;
+static Eldbus_Message *
+_e_info_server_cb_desk_area_ec_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
- _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos);
+ Eldbus_Message_Iter *array_of_ec_in_desk_area;
+ Eina_List *zl, *dal, *comp_zone_list;
+ E_Zone *zone;
+ E_Desk *desk;
+ E_Desk_Area *eda;
+ E_Client *ec;
+ int zone_id;
+ int desk_id_x, desk_id_y;
+ int i, layer, desk_count;
+ int target_zone_id, target_desk_x, target_desk_y, target_desk_area_id;
- e_comp_object_input_rect_get(ec->frame, &list_input_region);
- if (list_input_region)
- {
- has_input_region = EINA_TRUE;
- list_input_region = eina_list_free(list_input_region);
- }
- e_client_geometry_get(ec, &x, &y, &w, &h);
+ if (!eldbus_message_arguments_get(msg, "iiii", &target_zone_id, &target_desk_x, &target_desk_y, &target_desk_area_id))
+ {
+ ERR("Error getting arguments.");
+ return reply;
+ }
- transformed = e_client_transform_core_enable_get(ec);
+ eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_TOPVWINS")", &array_of_ec_in_desk_area);
- zone = e_comp_zone_find_by_ec(ec);
- if (zone)
- zone_id = zone->id;
+ comp_zone_list = e_comp_zone_list_get();
+ EINA_LIST_FOREACH(comp_zone_list, zl, zone)
+ {
+ zone_id = zone->id;
+ if (zone_id != target_zone_id) continue;
- desk = e_zone_desk_find_by_ec(zone, ec);
- if (desk)
+ desk_count = zone->desk_y_count * zone->desk_x_count;
+ for (i = 0; i < desk_count; i++)
{
+ desk = zone->desks[i];
desk_id_x = desk->x;
desk_id_y = desk->y;
- }
- eda = e_desk_desk_area_find_by_ec(desk, ec);
- if (eda)
- {
- desk_area_id = eda->id;
- }
+ if ((desk_id_x != target_desk_x) || (desk_id_y != target_desk_y)) continue;
- eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
+ for (layer=E_DESK_AREA_LAYER_COUNT-1; layer>=0; layer--)
+ {
+ EINA_LIST_FOREACH(desk->desk_area.list[layer], dal, eda)
+ {
+ Eldbus_Message_Iter *struct_of_ec_in_desk_area;
- eldbus_message_iter_arguments_append
- (struct_of_ec, VALUE_TYPE_FOR_TOPVWINS,
- win,
- res_id,
- pid,
- e_client_util_name_get(ec) ?: "NO NAME",
- x, y, w, h, ec->layer,
- ec->visible, mapped, ec->argb, ec->visibility.opaque, e_client_visibility_get(ec), ec->visibility.force_obscured, iconified,
- evas_object_visible_get(ec->frame), ec->focused, hwc, hwc_policy, pl_zpos, pwin, layer_name, has_input_region, transformed, ec->transient_policy,
- zone_id, desk_id_x, desk_id_y, desk_area_id, e_client_is_layout_apply(ec));
+ if (eda->id != target_desk_area_id) continue;
- eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
+ E_DESK_AREA_CLIENT_REVERSE_FOREACH(eda, ec)
+ {
+ if (e_client_util_ignored_get(ec)) continue;
+
+ eldbus_message_iter_arguments_append(array_of_ec_in_desk_area, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec_in_desk_area);
+ _msg_ec_append(struct_of_ec_in_desk_area, ec);
+ eldbus_message_iter_container_close(array_of_ec_in_desk_area, struct_of_ec_in_desk_area);
+ }
+ }
+ }
+ }
}
- eldbus_message_iter_container_close(iter, array_of_ec);
+ eldbus_message_iter_container_close(iter, array_of_ec_in_desk_area);
+ return reply;
}
static void
{ "get_zone_info", NULL, ELDBUS_ARGS({"("VALUE_TYPE_FOR_ZONE")", "array of zone"}), _e_info_server_cb_zone_info_get, 0 },
{ "get_desk_info", NULL, ELDBUS_ARGS({"("VALUE_TYPE_FOR_DESK")", "array of desk"}), _e_info_server_cb_desk_info_get, 0 },
{ "get_desk_area_info", NULL, ELDBUS_ARGS({"("VALUE_TYPE_FOR_DESK_AREA")", "array of desk_area"}), _e_info_server_cb_desk_area_info_get, 0 },
+ { "get_desk_area_ec_info", ELDBUS_ARGS({"iiii", "id of zone, desk_x, desk_y, desk_area"}), ELDBUS_ARGS({"a("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_desk_area_ec_info_get, 0 },
{ "compobjs", NULL, ELDBUS_ARGS({"a("SIGNATURE_COMPOBJS_CLIENT")", "array of comp objs"}), _e_info_server_cb_compobjs, 0 },
{ "subsurface", NULL, ELDBUS_ARGS({"a("SIGNATURE_SUBSURFACE")", "array of ec"}), _e_info_server_cb_subsurface, 0 },
{ "dump_wins", ELDBUS_ARGS({SIGNATURE_DUMP_WINS, "directory"}), ELDBUS_ARGS({"s", "result of dump"}), _e_info_server_cb_wins_dump, 0 },