1 #include "e_info_server_intern.h"
2 #include "e_utils_intern.h"
3 #include "e_comp_object.h"
4 #include "e_info_protocol_intern.h"
5 #include "e_info_server_input_intern.h"
6 #include "services/e_service_quickpanel_intern.h"
7 #include "services/e_service_kvm_intern.h"
8 #include "e_process_intern.h"
9 #include "e_comp_screen_intern.h"
10 #include "e_comp_wl_rsm_intern.h"
11 #include "e_explicit_sync_intern.h"
12 #include "e_comp_wl_subsurface_intern.h"
13 #include "e_comp_wl_tbm_intern.h"
14 #include "e_comp_intern.h"
15 #include "e_config_intern.h"
16 #include "e_input_intern.h"
17 #include "e_presentation_time_intern.h"
18 #include "e_policy_intern.h"
19 #include "e_policy_wl_intern.h"
20 #include "e_output_intern.h"
21 #include "e_module_intern.h"
22 #include "e_magnifier_intern.h"
23 #include "e_hwc_window_intern.h"
24 #include "e_hwc_windows_intern.h"
25 #include "e_hwc_intern.h"
26 #include "e_focus_intern.h"
27 #include "e_client_video_intern.h"
28 #include "e_video_debug_intern.h"
29 #include "e_client_intern.h"
30 #include "e_comp_object_intern.h"
31 #include "e_desk_area_intern.h"
32 #include "e_desk_intern.h"
33 #include "e_zone_intern.h"
34 #include "e_screensaver_intern.h"
35 #include "e_comp_wl_input_intern.h"
36 #include "e_main_intern.h"
37 #include "e_dbus_conn_intern.h"
38 #include "e_hints_intern.h"
39 #include "e_comp_input_intern.h"
41 #include <tbm_bufmgr.h>
42 #include <tbm_surface.h>
43 #include <tbm_surface_internal.h>
44 #include <tdm_helper.h>
45 #include <wayland-tbm-server.h>
49 #define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
50 #include <Edje_Edit.h>
52 #define USE_WAYLAND_LOG_TRACE
54 void wl_map_for_each(struct wl_map *map, void *func, void *data);
56 #define BUS "org.enlightenment.wm"
57 #define PATH "/org/enlightenment/wm"
58 #define IFACE "org.enlightenment.wm.info"
60 #define ERR_BASE "org.enlightenment.wm.Error."
61 #define INVALID_ARGS ERR_BASE"InvalidArguments"
62 #define GET_CALL_MSG_ARG_ERR ERR_BASE"GetCallMsgArgFailed"
63 #define WIN_NOT_EXIST ERR_BASE"WindowNotExist"
64 #define INVALID_PROPERTY_NAME ERR_BASE"InvalidPropertyName"
65 #define FAIL_TO_SET_PROPERTY ERR_BASE"FailedToSetProperty"
66 #define FAIL_TO_GET_PROPERTY ERR_BASE"FailedToGetProperty"
68 E_API int E_EVENT_INFO_ROTATION_MESSAGE = -1;
70 typedef struct _E_Info_Server
72 Eldbus_Connection *edbus_conn;
73 Eldbus_Connection_Type edbus_conn_type;
74 Eldbus_Service_Interface *iface;
75 Ecore_Event_Handler *dbus_init_done_handler;
78 typedef struct _E_Info_Transform
81 E_Util_Transform *transform;
87 static E_Info_Server e_info_server;
88 static Eina_List *e_info_transform_list = NULL;
90 static Eina_List *e_info_dump_hdlrs;
91 static char *e_info_dump_path;
92 static int e_info_dump_running;
93 static int e_info_dump_count;
94 static int e_info_dump_mark;
95 static int e_info_dump_mark_count;
96 static int e_info_dump_remote_surface = 0;
97 static int e_info_dump_server_or_client = 0; // 1: server 2: client
98 static uint64_t e_info_dump_win_id = 0;
100 //FILE pointer for protocol_trace
101 static FILE *log_fp_ptrace = NULL;
103 //wayland protocol logger
104 static struct wl_protocol_logger *e_info_protocol_logger;
106 // Module list for module info
107 static Eina_List *module_hook = NULL;
109 #define BUF_SNPRINTF(fmt, ARG...) do { \
110 str_l = snprintf(str_buff, str_r, fmt, ##ARG); \
115 #define VALUE_TYPE_FOR_ZONE "iiiiiibii"
116 #define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbbiibibbiiiusbbiib"
117 #define VALUE_TYPE_REQUEST_RESLIST "ui"
118 #define VALUE_TYPE_REPLY_RESLIST "ssu"
119 #define VALUE_TYPE_FOR_INPUTDEV "ssiss"
120 #define VALUE_TYPE_FOR_PENDING_COMMIT "uiuu"
121 #define VALUE_TYPE_FOR_FPS "usiud"
122 #define VALUE_TYPE_REQUEST_FOR_KILL "uts"
123 #define VALUE_TYPE_REPLY_KILL "s"
124 #define VALUE_TYPE_REQUEST_FOR_WININFO "t"
125 #define VALUE_TYPE_REPLY_WININFO "uiiiiiibbiibbbiitsiiib"
126 #define VALUE_TYPE_REQUEST_FOR_WININFO_TREE "ti"
127 #define VALUE_TYPE_REPLY_WININFO_TREE "tsia(tsiiiiiiii)"
131 E_INFO_SERVER_SIGNAL_WIN_UNDER_TOUCH = 0
134 static E_Info_Transform *_e_info_transform_new(E_Client *ec, int id, int enable, int x, int y, int sx, int sy, int degree, int background, const char *role);
135 static E_Info_Transform *_e_info_transform_find(E_Client *ec, int id);
136 static void _e_info_transform_set(E_Info_Transform *transform, int enable, int x, int y, int sx, int sy, int degree);
137 static void _e_info_transform_del(E_Info_Transform *transform);
138 static void _e_info_transform_del_with_id(E_Client *ec, int id);
140 static int _e_info_server_hooks_delete = 0;
141 static int _e_info_server_hooks_walking = 0;
143 static Eina_Inlist *_e_info_server_hooks[] =
145 [E_INFO_SERVER_HOOK_BUFFER_DUMP_BEGIN] = NULL,
146 [E_INFO_SERVER_HOOK_BUFFER_DUMP_END] = NULL
150 _e_info_server_hooks_clean(void)
153 E_Info_Server_Hook *iswh;
156 for (x = 0; x < E_INFO_SERVER_HOOK_LAST; x++)
157 EINA_INLIST_FOREACH_SAFE(_e_info_server_hooks[x], l, iswh)
159 if (!iswh->delete_me) continue;
160 _e_info_server_hooks[x] = eina_inlist_remove(_e_info_server_hooks[x],
161 EINA_INLIST_GET(iswh));
167 _e_info_server_hook_call(E_Info_Server_Hook_Point hookpoint, void *data EINA_UNUSED)
169 E_Info_Server_Hook *iswh;
171 _e_info_server_hooks_walking++;
172 EINA_INLIST_FOREACH(_e_info_server_hooks[hookpoint], iswh)
174 if (iswh->delete_me) continue;
175 iswh->func(iswh->data);
177 _e_info_server_hooks_walking--;
178 if ((_e_info_server_hooks_walking == 0) && (_e_info_server_hooks_delete > 0))
179 _e_info_server_hooks_clean();
182 E_API E_Info_Server_Hook *
183 e_info_server_hook_add(E_Info_Server_Hook_Point hookpoint, E_Info_Server_Hook_Cb func, const void *data)
185 E_Info_Server_Hook *iswh;
187 EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_INFO_SERVER_HOOK_LAST, NULL);
188 iswh = E_NEW(E_Info_Server_Hook, 1);
189 EINA_SAFETY_ON_NULL_RETURN_VAL(iswh, NULL);
190 iswh->hookpoint = hookpoint;
192 iswh->data = (void*)data;
193 _e_info_server_hooks[hookpoint] = eina_inlist_append(_e_info_server_hooks[hookpoint],
194 EINA_INLIST_GET(iswh));
199 e_info_server_hook_del(E_Info_Server_Hook *iswh)
202 if (_e_info_server_hooks_walking == 0)
204 _e_info_server_hooks[iswh->hookpoint] = eina_inlist_remove(_e_info_server_hooks[iswh->hookpoint],
205 EINA_INLIST_GET(iswh));
209 _e_info_server_hooks_delete++;
213 e_info_server_hook_call(E_Info_Server_Hook_Point hookpoint)
215 if (hookpoint >= E_INFO_SERVER_HOOK_LAST) return;
217 _e_info_server_hook_call(hookpoint, NULL);
221 _e_info_server_ec_hwc_info_get(E_Client *ec, int *hwc, int *hwc_policy, int *pl_zpos)
227 E_Hwc_Window *hwc_window = NULL;
232 if ((!e_comp->hwc) || e_comp_hwc_deactive_get())
237 zone = e_comp_zone_find_by_ec(ec);
239 eout = e_output_find(zone->output_id);
242 *hwc_policy = e_hwc_policy_get(eout->hwc);
244 if (*hwc_policy == E_HWC_POLICY_PLANES)
246 EINA_LIST_FOREACH(eout->planes, l, ep)
248 if (e_plane_is_fb_target(ep))
261 if (!ec->hwc_window) return;
262 hwc_window = ec->hwc_window;
263 if (e_hwc_window_is_on_hw_overlay(hwc_window))
266 *pl_zpos = e_hwc_window_accepted_state_get(hwc_window);
270 static Eldbus_Message *
271 _e_info_server_cb_zone_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
273 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
274 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
276 Eldbus_Message_Iter *array_of_zone;
279 E_Zone *current_zone = NULL;
282 Eina_Bool is_current_zone = EINA_FALSE;
284 int angle_active = 0;
286 eldbus_message_iter_arguments_append(iter, "("VALUE_TYPE_FOR_ZONE")", &array_of_zone);
288 current_zone = e_zone_current_get();
289 EINA_LIST_FOREACH(e_comp->zones, l, zone)
291 Eldbus_Message_Iter *struct_of_zone;
293 disp_state = e_zone_display_state_get(zone);
294 if (current_zone == zone)
295 is_current_zone = EINA_TRUE;
297 is_current_zone = EINA_FALSE;
299 angle_cur = zone->rot.curr;
300 angle_active = zone->rot.act;
302 eldbus_message_iter_arguments_append(array_of_zone, "("VALUE_TYPE_FOR_ZONE")", &struct_of_zone);
303 eldbus_message_iter_arguments_append(struct_of_zone, VALUE_TYPE_FOR_ZONE, zone_id, disp_state, zone->x, zone->y, zone->w, zone->h, is_current_zone, angle_cur, angle_active);
305 eldbus_message_iter_container_close(array_of_zone, struct_of_zone);
308 eldbus_message_iter_container_close(iter, array_of_zone);
314 _msg_ecs_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
316 Eldbus_Message_Iter *array_of_ec;
319 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_TOPVWINS")", &array_of_ec);
322 E_CLIENT_REVERSE_FOREACH(ec)
324 Eldbus_Message_Iter* struct_of_ec;
329 char layer_name[128] = {0,};
330 int hwc = -1, hwc_policy = E_HWC_POLICY_NONE, pl_zpos = -999;
332 Eina_Bool has_input_region = EINA_FALSE;
333 Eina_List *list_input_region = NULL;
334 Eina_Bool mapped = EINA_FALSE;
335 Eina_Bool transformed = EINA_FALSE;
336 int x = 0, y = 0, w = 0, h = 0;
338 E_Iconified_Type iconified_type;
341 if (is_visible && e_client_util_ignored_get(ec)) continue;
343 win = e_client_util_win_get(ec);
344 e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name));
346 pwin = e_client_util_win_get(ec->parent);
349 res_id = e_pixmap_res_id_get(ec->pixmap);
356 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
358 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
364 iconified_type = e_client_iconified_type_get(ec);
365 if (iconified_type == 0)
367 // if iconified_type is 0, then there is code not to set iconify_type
368 // before calling e_client_iconify. We have to find and fix it.
372 iconified = iconified_type;
378 mapped = ec->comp_data->mapped;
380 _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos);
382 e_comp_object_input_rect_get(ec->frame, &list_input_region);
383 if (list_input_region)
385 has_input_region = EINA_TRUE;
386 list_input_region = eina_list_free(list_input_region);
388 e_client_geometry_get(ec, &x, &y, &w, &h);
390 transformed = e_client_transform_core_enable_get(ec);
392 zone = e_comp_zone_find_by_ec(ec);
396 eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
398 eldbus_message_iter_arguments_append
399 (struct_of_ec, VALUE_TYPE_FOR_TOPVWINS,
403 e_client_util_name_get(ec) ?: "NO NAME",
404 x, y, w, h, ec->layer,
405 ec->visible, mapped, ec->argb, ec->visibility.opaque, e_client_visibility_get(ec), ec->visibility.force_obscured, iconified,
406 evas_object_visible_get(ec->frame), ec->focused, hwc, hwc_policy, pl_zpos, pwin, layer_name, has_input_region, transformed, ec->transient_policy,
407 zone_id, ec->apply_layout);
409 eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
412 eldbus_message_iter_container_close(iter, array_of_ec);
416 _msg_clients_append(Eldbus_Message_Iter *iter, Eina_Bool is_visible)
418 Eldbus_Message_Iter *array_of_ec;
422 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_TOPVWINS")", &array_of_ec);
425 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
427 Eldbus_Message_Iter* struct_of_ec;
432 char layer_name[128] = {0,};
433 int hwc = -1, hwc_policy = E_HWC_POLICY_NONE, pl_zpos = -999;
435 Eina_Bool has_input_region = EINA_FALSE;
436 Eina_List *list_input_region = NULL;
437 Eina_Bool mapped = EINA_FALSE;
438 Eina_Bool transformed = EINA_FALSE;
440 E_Iconified_Type iconified_type;
443 ec = evas_object_data_get(o, "E_Client");
445 if (is_visible && e_client_util_ignored_get(ec)) continue;
447 win = e_client_util_win_get(ec);
448 e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name));
450 pwin = e_client_util_win_get(ec->parent);
453 res_id = e_pixmap_res_id_get(ec->pixmap);
460 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
462 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
468 iconified_type = e_client_iconified_type_get(ec);
469 if (iconified_type == 0)
471 // if iconified_type is 0, then there is code not to set iconify_type
472 // before calling e_client_iconify. We have to find and fix it.
476 iconified = iconified_type;
482 mapped = ec->comp_data->mapped;
484 _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos);
486 e_comp_object_input_rect_get(o, &list_input_region);
487 if (list_input_region)
489 has_input_region = EINA_TRUE;
490 list_input_region = eina_list_free(list_input_region);
493 transformed = e_client_transform_core_enable_get(ec);
495 zone = e_comp_zone_find_by_ec(ec);
499 eldbus_message_iter_arguments_append(array_of_ec, "("VALUE_TYPE_FOR_TOPVWINS")", &struct_of_ec);
501 eldbus_message_iter_arguments_append
502 (struct_of_ec, VALUE_TYPE_FOR_TOPVWINS,
506 e_client_util_name_get(ec) ?: "NO NAME",
507 ec->x, ec->y, ec->w, ec->h, ec->layer,
508 ec->visible, mapped, ec->argb, ec->visibility.opaque, e_client_visibility_get(ec), ec->visibility.force_obscured, iconified,
509 evas_object_visible_get(ec->frame), ec->focused, hwc, hwc_policy, pl_zpos, pwin, layer_name, has_input_region, transformed, ec->transient_policy,
510 zone_id, ec->apply_layout);
512 eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
515 eldbus_message_iter_container_close(iter, array_of_ec);
519 _e_info_server_is_hwc_windows()
521 E_Output *primary_output;
523 primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
527 if (e_hwc_policy_get(primary_output->hwc) == E_HWC_POLICY_WINDOWS)
533 /* Method Handlers */
534 static Eldbus_Message *
535 _e_info_server_cb_window_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
537 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
538 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
540 eldbus_message_iter_basic_append(iter, 'i', e_comp_gl_get());
541 eldbus_message_iter_basic_append(iter, 'i', e_comp_config_get()->hwc);
542 eldbus_message_iter_basic_append(iter, 'i', e_comp_config_get()->hwc_use_multi_plane);
543 eldbus_message_iter_basic_append(iter, 'i', e_comp->hwc);
544 eldbus_message_iter_basic_append(iter, 'i', _e_info_server_is_hwc_windows());
545 eldbus_message_iter_basic_append(iter, 's', ecore_evas_engine_name_get(e_comp->ee));
546 eldbus_message_iter_basic_append(iter, 'i', e_comp_config_get()->engine);
547 eldbus_message_iter_basic_append(iter, 'i', e_config->use_buffer_flush);
548 eldbus_message_iter_basic_append(iter, 'i', e_config->deiconify_approve);
550 _msg_clients_append(iter, EINA_TRUE);
555 /* Method Handlers */
556 static Eldbus_Message *
557 _e_info_server_cb_ec_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
559 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
560 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
562 eldbus_message_iter_basic_append(iter, 'i', e_comp->hwc);
563 eldbus_message_iter_basic_append(iter, 'i', _e_info_server_is_hwc_windows());
565 _msg_ecs_append(iter, EINA_TRUE);
569 static Eldbus_Message *
570 _e_info_server_cb_all_ec_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
572 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
573 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
575 eldbus_message_iter_basic_append(iter, 'i', e_comp->hwc);
576 eldbus_message_iter_basic_append(iter, 'i', _e_info_server_is_hwc_windows());
578 _msg_ecs_append(iter, EINA_FALSE);
583 /* Method Handlers */
584 static Eldbus_Message *
585 _e_info_server_cb_all_window_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
587 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
588 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
590 eldbus_message_iter_basic_append(iter, 'i', e_comp->hwc);
591 eldbus_message_iter_basic_append(iter, 'i', _e_info_server_is_hwc_windows());
593 _msg_clients_append(iter, EINA_FALSE);
598 typedef struct _Obj_Info
600 Evas_Object *po; /* parent object */
606 _obj_info_get(Evas_Object *po, Evas_Object *o, int depth)
608 Obj_Info *info = E_NEW(Obj_Info, 1);
609 EINA_SAFETY_ON_NULL_RETURN_VAL(info, NULL);
617 static E_Info_Comp_Obj *
618 _compobj_info_get(Evas_Object *po, Evas_Object *o, int depth)
620 E_Info_Comp_Obj *cobj;
621 const char *name = NULL, *type = NULL;
622 const char *file = NULL, *group = NULL, *part = NULL, *key = NULL;
626 Evas_Object *edit_obj = NULL, *c = NULL;
627 Eina_List *parts = NULL, *ll;
628 Evas_Native_Surface *ns;
630 cobj = E_NEW(E_Info_Comp_Obj, 1);
631 EINA_SAFETY_ON_NULL_RETURN_VAL(cobj, NULL);
633 cobj->obj = (uintptr_t)o;
636 type = evas_object_type_get(o);
637 if (!e_util_strcmp(type, "rectangle" )) cobj->type = eina_stringshare_add("r");
638 else if (!e_util_strcmp(type, "edje" )) cobj->type = eina_stringshare_add("EDJ");
639 else if (!e_util_strcmp(type, "image" )) cobj->type = eina_stringshare_add("IMG");
640 else if (!e_util_strcmp(type, "e_comp_object")) cobj->type = eina_stringshare_add("EC");
641 else cobj->type = eina_stringshare_add(type);
643 cobj->name = eina_stringshare_add("no_use");
644 name = evas_object_name_get(o);
647 eina_stringshare_del(cobj->name);
648 cobj->name = eina_stringshare_add(name);
651 evas_object_geometry_get(o, &cobj->x, &cobj->y, &cobj->w, &cobj->h);
652 evas_object_color_get(o, &cobj->r, &cobj->g, &cobj->b, &cobj->a);
653 cobj->pass_events = evas_object_pass_events_get(o);
654 cobj->freeze_events = evas_object_freeze_events_get(o);
655 cobj->focus = evas_object_focus_get(o);
656 cobj->vis = evas_object_visible_get(o);
657 cobj->ly = evas_object_layer_get(o);
659 #define _CLAMP(x) if ((x >= 0) && (x > 9999)) x = 9999; else if (x < -999) x = -999;
667 switch (evas_object_render_op_get(o))
669 case EVAS_RENDER_BLEND: cobj->opmode = eina_stringshare_add("BL" ); break;
670 case EVAS_RENDER_COPY: cobj->opmode = eina_stringshare_add("CP" ); break;
671 default: cobj->opmode = eina_stringshare_add("NO" ); break;
674 if ((!e_util_strcmp(cobj->name, "no_use")) &&
675 (!e_util_strcmp(cobj->type, "EC")))
677 ec = evas_object_data_get(o, "E_Client");
680 /* append window id, client pid and window title */
681 eina_stringshare_del(cobj->name);
683 snprintf(buf, sizeof(buf), "%zx %d %s",
684 e_client_util_win_get(ec),
686 e_client_util_name_get(ec));
688 cobj->name = eina_stringshare_add(buf);
692 /* get edje file path and group name if it is a edje object */
693 cobj->edje.file = eina_stringshare_add("no_use");
694 cobj->edje.group = eina_stringshare_add("no_use");
695 if (!e_util_strcmp(cobj->type, "EDJ"))
697 edje_object_file_get(o, &file, &group);
701 eina_stringshare_del(cobj->edje.file);
702 cobj->edje.file = eina_stringshare_add(file);
707 eina_stringshare_del(cobj->edje.group);
708 cobj->edje.group = eina_stringshare_add(group);
712 /* get part name and part value if it is a member of parent edje object */
713 cobj->edje.part = eina_stringshare_add("no_use");
716 type = evas_object_type_get(po);
717 if (!e_util_strcmp(type, "edje"))
719 edje_object_file_get(po, &file, &group);
720 edit_obj = edje_edit_object_add(e_comp->evas);
721 if (edje_object_file_set(edit_obj, file, group))
723 parts = edje_edit_parts_list_get(edit_obj);
724 EINA_LIST_FOREACH(parts, ll, part)
726 c = (Evas_Object *)edje_object_part_object_get(po, part);
729 edje_object_part_state_get(po, part, &val);
731 eina_stringshare_del(cobj->edje.part);
732 cobj->edje.part = eina_stringshare_add(part);
733 cobj->edje.val = val;
737 edje_edit_string_list_free(parts);
739 evas_object_del(edit_obj);
743 /* get image object information */
744 cobj->img.native_type = eina_stringshare_add("no_use");
745 cobj->img.file = eina_stringshare_add("no_use");
746 cobj->img.key = eina_stringshare_add("no_use");
748 if (!e_util_strcmp(cobj->type, "IMG"))
750 ns = evas_object_image_native_surface_get(o);
753 cobj->img.native = EINA_TRUE;
754 eina_stringshare_del(cobj->img.native_type);
757 case EVAS_NATIVE_SURFACE_WL:
758 cobj->img.native_type = eina_stringshare_add("WL");
759 cobj->img.data = (uintptr_t)ns->data.wl.legacy_buffer;
761 case EVAS_NATIVE_SURFACE_TBM:
762 cobj->img.native_type = eina_stringshare_add("TBM");
763 cobj->img.data = (uintptr_t)ns->data.tbm.buffer;
766 cobj->img.native_type = eina_stringshare_add("?");
773 evas_object_image_file_get(o, &file, &key);
777 eina_stringshare_del(cobj->img.file);
778 cobj->img.file = eina_stringshare_add(file);
783 eina_stringshare_del(cobj->img.key);
784 cobj->img.key = eina_stringshare_add(key);
787 cobj->img.data = (uintptr_t)evas_object_image_data_get(o, 0);
790 evas_object_image_size_get(o, &cobj->img.w, &cobj->img.h);
791 evas_object_image_load_size_get(o, &cobj->img.lw, &cobj->img.lh);
792 evas_object_image_fill_get(o, &cobj->img.fx, &cobj->img.fy, &cobj->img.fw, &cobj->img.fh);
793 cobj->img.alpha = evas_object_image_alpha_get(o);
794 cobj->img.dirty = evas_object_image_pixels_dirty_get(o);
797 if (evas_object_map_enable_get(o))
799 E_Map *m = e_comp_object_map_get(o);
803 cobj->map.enable = EINA_TRUE;
804 cobj->map.alpha = e_map_alpha_get(m);
805 for (i = 0; i < 4; i++)
808 e_map_point_image_uv_get(m, i, &cobj->map.u[i], &cobj->map.v[i]);
809 e_map_point_coord_get(m, i, &x, &y, &z);
821 static Eldbus_Message *
822 _e_info_server_cb_compobjs(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
824 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
825 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
826 Eldbus_Message_Iter *cobjs;
828 Obj_Info *info, *info2;
829 E_Info_Comp_Obj *cobj;
830 Eina_List *stack = NULL; /* stack for DFS */
831 Eina_List *queue = NULL; /* result queue */
832 Eina_List *ll = NULL;
834 eldbus_message_iter_arguments_append(iter,
835 "a("SIGNATURE_COMPOBJS_CLIENT")",
838 /* 1. push: top-level evas objects */
839 for (o = evas_object_bottom_get(e_comp->evas); o; o = evas_object_above_get(o))
841 info = _obj_info_get(NULL, o, 0);
843 stack = eina_list_append(stack, info);
849 info = eina_list_last_data_get(stack);
853 cobj = _compobj_info_get(info->po, info->o, info->depth);
855 queue = eina_list_append(queue, cobj);
857 /* 3. push : child objects */
858 if ((evas_object_smart_smart_get(info->o)) || (!e_util_strcmp(cobj->type, "EDJ")))
860 if (evas_object_smart_data_get(info->o))
862 EINA_LIST_FOREACH(evas_object_smart_members_get(info->o), ll, c)
864 info2 = _obj_info_get(info->o, c, info->depth + 1);
865 stack = eina_list_append(stack, info2);
870 stack = eina_list_remove(stack, info);
875 EINA_LIST_FREE(queue, cobj)
877 Eldbus_Message_Iter *struct_of_cobj;
878 eldbus_message_iter_arguments_append(cobjs,
879 "("SIGNATURE_COMPOBJS_CLIENT")",
882 eldbus_message_iter_arguments_append(struct_of_cobj,
883 SIGNATURE_COMPOBJS_CLIENT,
890 cobj->x, cobj->y, cobj->w, cobj->h,
891 cobj->r, cobj->g, cobj->b, cobj->a,
901 cobj->img.native_type,
905 cobj->img.w, cobj->img.h,
906 cobj->img.lw, cobj->img.lh,
907 cobj->img.fx, cobj->img.fy, cobj->img.fw, cobj->img.fh,
912 cobj->map.u[0], cobj->map.u[1], cobj->map.u[2], cobj->map.u[3],
913 cobj->map.v[0], cobj->map.v[1], cobj->map.v[2], cobj->map.v[3],
914 cobj->map.x[0], cobj->map.x[1], cobj->map.x[2], cobj->map.x[3],
915 cobj->map.y[0], cobj->map.y[1], cobj->map.y[2], cobj->map.y[3],
916 cobj->map.z[0], cobj->map.z[1], cobj->map.z[2], cobj->map.z[3]);
918 eldbus_message_iter_container_close(cobjs, struct_of_cobj);
920 eina_stringshare_del(cobj->type);
921 eina_stringshare_del(cobj->name);
922 eina_stringshare_del(cobj->opmode);
923 eina_stringshare_del(cobj->edje.file);
924 eina_stringshare_del(cobj->edje.group);
925 eina_stringshare_del(cobj->edje.part);
926 eina_stringshare_del(cobj->img.native_type);
927 eina_stringshare_del(cobj->img.file);
928 eina_stringshare_del(cobj->img.key);
932 eldbus_message_iter_container_close(iter, cobjs);
937 _input_msg_clients_append(Eldbus_Message_Iter *iter)
939 Eldbus_Message_Iter *array_of_input;
941 E_Devicemgr_Input_Device *dev;
942 const char *output_name = NULL;
944 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_INPUTDEV")", &array_of_input);
946 g_rec_mutex_lock(&e_devicemgr->device_list_mutex);
947 EINA_LIST_FOREACH(e_devicemgr->device_list, l, dev)
949 Eldbus_Message_Iter *struct_of_input;
951 eldbus_message_iter_arguments_append(array_of_input, "("VALUE_TYPE_FOR_INPUTDEV")", &struct_of_input);
953 output_name = e_input_device_output_name_get(NULL, dev->identifier);
954 if (!output_name) output_name = "None";
955 eldbus_message_iter_arguments_append
956 (struct_of_input, VALUE_TYPE_FOR_INPUTDEV,
957 dev->name, dev->identifier, dev->clas, dev->seat_name, output_name);
959 eldbus_message_iter_container_close(array_of_input, struct_of_input);
961 g_rec_mutex_unlock(&e_devicemgr->device_list_mutex);
962 eldbus_message_iter_container_close(iter, array_of_input);
966 static Eldbus_Message *
967 _e_info_server_cb_input_device_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
969 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
971 _input_msg_clients_append(eldbus_message_iter_get(reply));
977 _msg_connected_clients_append(Eldbus_Message_Iter *iter)
979 Eldbus_Message_Iter *array_of_ec;
983 eldbus_message_iter_arguments_append(iter, "a(ss)", &array_of_ec);
986 E_Comp_Connected_Client_Info *cinfo;
989 Eldbus_Message_Iter* struct_of_ec;
991 #define __CONNECTED_CLIENTS_ARG_APPEND_TYPE(title, str, x...) ({ \
992 char __temp[128] = {0,}; \
993 snprintf(__temp, sizeof(__temp), str, ##x); \
994 eldbus_message_iter_arguments_append(array_of_ec, "(ss)", &struct_of_ec); \
995 eldbus_message_iter_arguments_append(struct_of_ec, "ss", (title), (__temp)); \
996 eldbus_message_iter_container_close(array_of_ec, struct_of_ec);})
998 EINA_LIST_FOREACH(e_comp->connected_clients, l, cinfo)
1000 __CONNECTED_CLIENTS_ARG_APPEND_TYPE("[Connected Clients]", "name:%20s pid:%3d uid:%3d gid:%3d", cinfo->name ?: "NO_NAME", cinfo->pid, cinfo->uid, cinfo->gid);
1001 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
1004 uint32_t res_id = 0;
1007 ec = evas_object_data_get(o, "E_Client");
1009 if (e_client_util_ignored_get(ec)) continue;
1011 win = e_client_util_win_get(ec);
1014 res_id = e_pixmap_res_id_get(ec->pixmap);
1017 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
1019 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
1021 if (cinfo->pid == pid)
1023 __CONNECTED_CLIENTS_ARG_APPEND_TYPE("[E_Client Info]", "win:0x%08zx res_id:%5d, name:%20s, geo:(%4d, %4d, %4dx%4d), layer:%5d, visible:%d, argb:%d",
1024 win, res_id, e_client_util_name_get(ec) ?: "NO_NAME", ec->x, ec->y, ec->w, ec->h, ec->layer, ec->visible, ec->argb);
1029 eldbus_message_iter_container_close(iter, array_of_ec);
1032 static Eldbus_Message *
1033 _e_info_server_cb_connected_clients_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
1035 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1037 _msg_connected_clients_append(eldbus_message_iter_get(reply));
1042 #ifndef wl_client_for_each
1043 #define wl_client_for_each(client, list) \
1044 for (client = 0, client = wl_client_from_link((list)->next); \
1045 wl_client_get_link(client) != (list); \
1046 client = wl_client_from_link(wl_client_get_link(client)->next))
1049 static int resurceCnt = 0;
1051 static enum wl_iterator_result
1052 _e_info_server_get_resource(struct wl_resource *resource, void *data)
1054 Eldbus_Message_Iter* array_of_res= data;
1055 Eldbus_Message_Iter* struct_of_res;
1057 eldbus_message_iter_arguments_append(array_of_res, "("VALUE_TYPE_REPLY_RESLIST")", &struct_of_res);
1058 eldbus_message_iter_arguments_append(struct_of_res, VALUE_TYPE_REPLY_RESLIST, "[resource]", wl_resource_get_class(resource), wl_resource_get_id(resource));
1059 eldbus_message_iter_container_close(array_of_res, struct_of_res);
1062 return WL_ITERATOR_CONTINUE;
1066 _msg_clients_res_list_append(Eldbus_Message_Iter *iter, uint32_t mode, int id)
1068 Eldbus_Message_Iter *array_of_res;
1070 struct wl_list * client_list;
1071 struct wl_client *client;
1072 E_Comp_Wl_Data *wl_cdata;
1080 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_REPLY_RESLIST")", &array_of_res);
1082 if (!e_comp) return;
1083 if (!(wl_cdata = e_comp->wl_comp_data)) return;
1084 if (!wl_cdata->wl.disp) return;
1086 client_list = wl_display_get_client_list(wl_cdata->wl.disp);
1088 wl_client_for_each(client, client_list)
1090 Eldbus_Message_Iter* struct_of_res;
1092 wl_client_get_credentials(client, &pid, NULL, NULL);
1094 if ((type == PID) && (pid != id)) continue;
1096 eldbus_message_iter_arguments_append(array_of_res, "("VALUE_TYPE_REPLY_RESLIST")", &struct_of_res);
1098 eldbus_message_iter_arguments_append(struct_of_res, VALUE_TYPE_REPLY_RESLIST, "[client]", "pid", (uint32_t)pid);
1099 eldbus_message_iter_container_close(array_of_res, struct_of_res);
1102 wl_client_for_each_resource(client, _e_info_server_get_resource, array_of_res);
1104 eldbus_message_iter_arguments_append(array_of_res, "("VALUE_TYPE_REPLY_RESLIST")", &struct_of_res);
1105 eldbus_message_iter_arguments_append(struct_of_res, VALUE_TYPE_REPLY_RESLIST, "[count]", "resurceCnt", (uint32_t)resurceCnt);
1106 eldbus_message_iter_container_close(array_of_res, struct_of_res);
1108 eldbus_message_iter_container_close(iter, array_of_res);
1111 static Eldbus_Message *
1112 _e_info_server_cb_res_lists_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
1114 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
1118 if (!eldbus_message_arguments_get(msg, VALUE_TYPE_REQUEST_RESLIST, &mode, &pid))
1120 ERR("Error getting arguments.");
1124 _msg_clients_res_list_append(eldbus_message_iter_get(reply), mode, pid);
1130 * behaves like strcat but also dynamically extends buffer when it's needed
1132 * dst - the pointer to result string (dynamically allocated) will be stored to memory 'dst' points to
1133 * '*dst' MUST either point nothing (nullptr) or point a !_dynamically allocated_! null-terminated string
1134 * (e.g. returned by the previous call)
1135 * src - null-terminated string to concatenate (can be either statically or dynamically allocated string)
1137 * *dst got to be freed by free() when it's no longer needed
1139 * return -1 in case of an error, 0 otherwise
1142 _astrcat(char **dst, const char *src)
1151 new_size = strlen(*dst) + strlen(src) + 1; /* + '/0' */
1153 new_size = strlen(src) + 1; /* + '/0' */
1155 /* if *dst is nullptr realloc behaves like malloc */
1156 res = realloc(*dst, new_size);
1160 /* if we were asked to concatenate to null string */
1162 res[0] = '\0'; /* strncat looks for null-terminated string */
1165 strncat(*dst, src, new_size - strlen(*dst) - 1);
1170 #define astrcat_(str, mod, x...) ({ \
1171 char *temp = NULL; \
1172 if (asprintf(&temp, mod, ##x) < 0) \
1174 if (_astrcat(str, temp) < 0) \
1183 _get_win_prop_Input_region(const Evas_Object *evas_obj)
1185 Eina_List *list = NULL, *l;
1186 Eina_Rectangle *data;
1189 e_comp_object_input_rect_get((Evas_Object *)evas_obj, &list);
1192 astrcat_(&str, "No Input Region\n");
1196 EINA_LIST_FOREACH(list, l, data)
1198 astrcat_(&str, "[(%d, %d) %dx%d]\n", data->x, data->y, data->w, data->h);
1200 list = eina_list_free(list);
1205 if (list) list = eina_list_free(list);
1212 _get_win_prop_Rotation(const Evas_Object *evas_obj)
1219 ec = evas_object_data_get(evas_obj, "E_Client");
1220 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1221 count = ec->e.state.rot.count;
1223 astrcat_(&str, "Support(%d) Type(%s)\n", ec->e.state.rot.support,
1224 ec->e.state.rot.type == E_CLIENT_ROTATION_TYPE_NORMAL ? "normal" : "dependent");
1226 if (ec->e.state.rot.available_rots && count)
1228 astrcat_(&str, "Availables[%d] ", count);
1230 for (i = 0; i < count; i++)
1231 astrcat_(&str, "%d ", ec->e.state.rot.available_rots[i]);
1234 astrcat_(&str, "Availables[%d] N/A", count);
1237 astrcat_(&str, "\nAngle prev(%d) curr(%d) next(%d) reserve(%d) preferred(%d)\n",
1238 ec->e.state.rot.ang.prev,
1239 ec->e.state.rot.ang.curr,
1240 ec->e.state.rot.ang.next,
1241 ec->e.state.rot.ang.reserve,
1242 ec->e.state.rot.preferred_rot);
1244 astrcat_(&str, "pending_change_request(%d) pending_show(%d) nopending_render(%d) wait_for_done(%d)\n",
1245 ec->e.state.rot.pending_change_request,
1246 ec->e.state.rot.pending_show,
1247 ec->e.state.rot.nopending_render,
1248 ec->e.state.rot.wait_for_done);
1250 if (ec->e.state.rot.geom_hint)
1251 for (i = 0; i < 4; i++)
1252 astrcat_(&str, "Geometry hint[%d] %d,%d %dx%d\n",
1254 ec->e.state.rot.geom[i].x,
1255 ec->e.state.rot.geom[i].y,
1256 ec->e.state.rot.geom[i].w,
1257 ec->e.state.rot.geom[i].h);
1267 _get_win_prop_Transform(const Evas_Object *evas_obj)
1274 ec = evas_object_data_get(evas_obj, "E_Client");
1275 count = e_client_transform_core_transform_count_get((E_Client *)ec);
1277 astrcat_(&str, "transform count: %d\n", count);
1282 astrcat_(&str, " [id] [role ] [move] [scale] [rot] [viewport]\n");
1284 for (i = 0; i < count; ++i)
1287 int x = 0, y = 0, rz = 0;
1289 int vx = 0, vy = 0, vw = 0, vh = 0;
1290 E_Util_Transform *transform = NULL;
1291 const char *tmp_str = NULL;
1292 char role[24] = {0,};
1294 transform = e_client_transform_core_transform_get((E_Client *)ec, i);
1295 if (!transform) continue;
1297 e_util_transform_move_round_get(transform, &x, &y, NULL);
1298 e_util_transform_scale_get(transform, &dsx, &dsy, NULL);
1299 e_util_transform_rotation_round_get(transform, NULL, NULL, &rz);
1300 view_port = e_util_transform_viewport_flag_get(transform);
1303 e_util_transform_viewport_get(transform, &vx, &vy, &vw, &vh);
1305 tmp_str = e_util_transform_role_get(transform);
1306 strncpy(role, (tmp_str ? tmp_str:"unknown"), sizeof(role)-1);
1308 astrcat_(&str, "transform : [%2d] [%-23s] [%4d, %4d] [%2.3f, %2.3f] [%3d] [%d :%d, %d, %d, %d]\n",
1309 i, role, x, y, dsx, dsy, rz, view_port, vx, vy, vw, vh);
1311 if (e_util_transform_bg_transform_flag_get(transform))
1313 e_util_transform_bg_move_round_get(transform, &x, &y, NULL);
1314 e_util_transform_bg_scale_get(transform, &dsx, &dsy, NULL);
1315 e_util_transform_bg_rotation_round_get(transform, NULL, NULL, &rz);
1317 astrcat_(&str, "transform_bg : [%2d] [%4d, %4d] [%2.3f, %2.3f] [%3d]\n",
1318 i, x, y, dsx, dsy, rz);
1330 _get_win_prop_Subsurface_Below_Child_List(const Evas_Object *evas_obj)
1332 const E_Comp_Wl_Client_Data *cdata;
1336 const Eina_List *list;
1338 const E_Client *child;
1340 ec = evas_object_data_get(evas_obj, "E_Client");
1341 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1344 return strdup("None");
1346 cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
1347 list = cdata->sub.below_list;
1350 return strdup("None");
1352 EINA_LIST_FOREACH(list, l, child)
1353 astrcat_(&str, "0x%zx, ", e_client_util_win_get(child));
1363 _get_win_prop_Subsurface_Child_List(const Evas_Object *evas_obj)
1365 const E_Comp_Wl_Client_Data *cdata;
1369 const Eina_List *list;
1371 const E_Client *child;
1373 ec = evas_object_data_get(evas_obj, "E_Client");
1374 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1377 return strdup("None");
1379 cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
1380 list = cdata->sub.list;
1383 return strdup("None");
1385 EINA_LIST_FOREACH(list, l, child)
1386 astrcat_(&str, "0x%zx, ", e_client_util_win_get(child));
1396 _get_win_prop_Subsurface_Parent(const Evas_Object *evas_obj)
1398 const E_Client *ec, *parent = NULL;
1401 ec = evas_object_data_get(evas_obj, "E_Client");
1402 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1405 return strdup("None");
1407 if (e_comp_wl_subsurface_check((E_Client *)ec))
1408 parent = e_comp_wl_subsurface_parent_get((E_Client *)ec);
1410 if (asprintf(&str, "0x%zx", parent ? e_client_util_win_get(parent) : 0) < 0)
1417 _get_win_prop_Aux_Hint(const Evas_Object *evas_obj)
1419 const E_Comp_Wl_Client_Data *cdata;
1420 const E_Comp_Wl_Aux_Hint *hint;
1426 ec = evas_object_data_get(evas_obj, "E_Client");
1427 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1430 return strdup("None");
1432 cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
1434 if (!cdata->aux_hint.hints)
1435 return strdup("None");
1437 EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint)
1438 astrcat_(&str, "[%d][%s][%s]\n", hint->id, hint->hint, hint->val);
1448 _get_win_prop_Video_Client(const Evas_Object *evas_obj)
1453 ec = evas_object_data_get(evas_obj, "E_Client");
1454 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1456 if (asprintf(&str, "%d", ec->comp_data ? (ec->comp_data->video_client || e_client_video_hw_composition_check((E_Client *)ec)) : 0) < 0)
1463 _get_win_prop_Transformed(const Evas_Object *evas_obj)
1465 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1466 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1468 return ec->transformed ? strdup("TRUE") : strdup("FALSE");
1472 _get_win_prop_Maximize_override(const Evas_Object *evas_obj)
1474 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1475 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1477 return ec->maximize_override ? strdup("TRUE") : strdup("FALSE");
1481 _set_win_prop_Ignored(Evas_Object *evas_obj, const char *prop_value)
1483 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1487 ERR("No ec available !Return NULL !");
1491 if(strstr(prop_value, "TRUE"))
1492 ec->ignored = 1; /* TODO: is't right? */
1493 else if(strstr(prop_value, "FALSE"))
1494 e_client_unignore(ec);
1496 return strdup("invalid property value");
1502 _get_win_prop_Ignored(const Evas_Object *evas_obj)
1504 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1505 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1507 return ec->ignored ? strdup("TRUE") : strdup("FALSE");
1511 _get_win_prop_Layer_block(const Evas_Object *evas_obj)
1513 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1514 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1516 return ec->layer_block ? strdup("TRUE") : strdup("FALSE");
1520 _set_win_prop_Redirected(Evas_Object *evas_obj, const char *prop_value)
1522 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1524 if(strstr(prop_value, "TRUE"))
1525 e_client_redirected_set(ec, EINA_TRUE);
1526 else if(strstr(prop_value, "FALSE"))
1527 e_client_redirected_set(ec, EINA_FALSE);
1529 return strdup("invalid property value");
1535 _get_win_prop_Redirected(const Evas_Object *evas_obj)
1537 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1538 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1540 return ec->redirected ? strdup("TRUE") : strdup("FALSE");
1544 _get_win_prop_Dialog(const Evas_Object *evas_obj)
1546 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1547 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1549 return ec->dialog ? strdup("TRUE") : strdup("FALSE");
1553 _get_win_prop_Input_only(const Evas_Object *evas_obj)
1555 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1556 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1558 return ec->input_only ? strdup("TRUE") : strdup("FALSE");
1562 _get_win_prop_Override(const Evas_Object *evas_obj)
1564 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1565 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1567 return ec->override ? strdup("TRUE") : strdup("FALSE");
1571 _get_win_prop_E_Transient_Policy(const Evas_Object *evas_obj)
1576 ec = evas_object_data_get(evas_obj, "E_Client");
1577 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1579 if (asprintf(&str, "%d", ec->transient_policy) < 0)
1586 _get_win_prop_E_FullScreen_Policy(const Evas_Object *evas_obj)
1591 ec = evas_object_data_get(evas_obj, "E_Client");
1592 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1594 if (asprintf(&str, "%d", ec->fullscreen_policy) < 0)
1601 _get_win_prop_E_Maximize_Policy(const Evas_Object *evas_obj)
1606 ec = evas_object_data_get(evas_obj, "E_Client");
1607 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1609 if (asprintf(&str, "0x%x", ec->maximized) < 0)
1616 _get_win_prop_Accept_focus(const Evas_Object *evas_obj)
1618 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1619 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1621 return ec->icccm.accepts_focus ? strdup("TRUE") : strdup("FALSE");
1625 _get_win_prop_Want_focus(const Evas_Object *evas_obj)
1627 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1628 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1630 return ec->want_focus ? strdup("TRUE") : strdup("FALSE");
1634 _get_win_prop_Take_focus(const Evas_Object *evas_obj)
1636 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1637 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1639 return ec->take_focus ? strdup("TRUE") : strdup("FALSE");
1643 _get_win_prop_Re_manage(const Evas_Object *evas_obj)
1645 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1646 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1648 return ec->re_manage ? strdup("TRUE") : strdup("FALSE");
1652 _set_win_prop_Fullscreen(Evas_Object *evas_obj, const char *prop_value)
1654 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1656 if(strstr(prop_value, "TRUE"))
1657 e_client_fullscreen(ec, E_FULLSCREEN_RESIZE); /* TODO: what a policy to use? */
1658 else if(strstr(prop_value, "FALSE"))
1659 e_client_unfullscreen(ec);
1661 return strdup("invalid property value");
1667 _get_win_prop_Fullscreen(const Evas_Object *evas_obj)
1669 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1670 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1672 return ec->fullscreen ? strdup("TRUE") : strdup("FALSE");
1676 _set_win_prop_Sticky(Evas_Object *evas_obj, const char *prop_value)
1678 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1680 if(strstr(prop_value, "TRUE"))
1682 else if(strstr(prop_value, "FALSE"))
1683 e_client_unstick(ec);
1685 return strdup("invalid property value");
1691 _get_win_prop_Sticky(const Evas_Object *evas_obj)
1693 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1694 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1696 return ec->sticky ? strdup("TRUE") : strdup("FALSE");
1700 _set_win_prop_Iconic(Evas_Object *evas_obj, const char *prop_value)
1702 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1703 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1705 if(strstr(prop_value, "TRUE"))
1706 e_client_iconify(ec);
1707 else if(strstr(prop_value, "FALSE"))
1708 e_client_uniconify(ec);
1710 return strdup("invalid property value");
1716 _get_win_prop_Iconic(const Evas_Object *evas_obj)
1718 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1719 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1721 return ec->iconic ? strdup("TRUE") : strdup("FALSE");
1725 _set_win_prop_Focused(Evas_Object *evas_obj, const char *prop_value)
1727 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1728 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1730 if(strstr(prop_value, "TRUE"))
1732 else if(strstr(prop_value, "FALSE"))
1735 return strdup("invalid property value");
1741 _get_win_prop_Focused(const Evas_Object *evas_obj)
1743 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1744 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1746 return ec->focused ? strdup("TRUE") : strdup("FALSE");
1750 _get_win_prop_Moving(const Evas_Object *evas_obj)
1752 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1753 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1755 return ec->moving ? strdup("TRUE") : strdup("FALSE");
1759 _set_win_prop_Hidden(Evas_Object *evas_obj, const char *prop_value)
1761 if(strstr(prop_value, "TRUE"))
1762 evas_object_hide(evas_obj);
1763 else if(strstr(prop_value, "FALSE"))
1764 evas_object_show(evas_obj);
1766 return strdup("invalid property value");
1772 _get_win_prop_Hidden(const Evas_Object *evas_obj)
1774 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1775 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1777 return ec->hidden ? strdup("TRUE") : strdup("FALSE");
1781 _get_win_prop_32bit(const Evas_Object *evas_obj)
1783 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1784 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1786 return ec->argb ? strdup("TRUE") : strdup("FALSE");
1790 _set_win_prop_Visible(Evas_Object *evas_obj, const char *prop_value)
1792 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1793 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1795 if(strstr(prop_value, "TRUE"))
1797 else if(strstr(prop_value, "FALSE"))
1800 return strdup("invalid property value");
1806 _get_win_prop_Visible(const Evas_Object *evas_obj)
1808 const E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1809 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1811 return ec->visible ? strdup("TRUE") : strdup("FALSE");
1814 /* this code looks awful but to make it sane some global changes are required,
1815 * but I'm not sure I'm allowed to do such changes which relate ONLY to e_info app */
1817 _check_layer_idx(const char *layer_name, int layer_idx)
1819 char tmp[64] = {0, };
1821 e_comp_layer_name_get(layer_idx, tmp, sizeof(tmp));
1823 return strncmp(tmp, layer_name, strlen(tmp));
1827 _e_comp_layer_idx_get(const char *layer_name)
1829 if (!layer_name) return E_LAYER_MAX + 1;
1831 if (!_check_layer_idx(layer_name, E_LAYER_BOTTOM)) return E_LAYER_BOTTOM;
1832 if (!_check_layer_idx(layer_name, E_LAYER_BG)) return E_LAYER_BG;
1833 if (!_check_layer_idx(layer_name, E_LAYER_DESKTOP)) return E_LAYER_DESKTOP;
1834 if (!_check_layer_idx(layer_name, E_LAYER_DESKTOP_TOP)) return E_LAYER_DESKTOP_TOP;
1835 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_DESKTOP)) return E_LAYER_CLIENT_DESKTOP;
1836 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_BELOW)) return E_LAYER_CLIENT_BELOW;
1837 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_NORMAL)) return E_LAYER_CLIENT_NORMAL;
1838 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_ABOVE)) return E_LAYER_CLIENT_ABOVE;
1839 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_EDGE)) return E_LAYER_CLIENT_EDGE;
1840 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_FULLSCREEN)) return E_LAYER_CLIENT_FULLSCREEN;
1841 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_EDGE_FULLSCREEN)) return E_LAYER_CLIENT_EDGE_FULLSCREEN;
1842 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_POPUP)) return E_LAYER_CLIENT_POPUP;
1843 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_TOP)) return E_LAYER_CLIENT_TOP;
1844 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_PRIO)) return E_LAYER_CLIENT_PRIO;
1845 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_NOTIFICATION_LOW)) return E_LAYER_CLIENT_NOTIFICATION_LOW;
1846 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_NOTIFICATION_NORMAL)) return E_LAYER_CLIENT_NOTIFICATION_NORMAL;
1847 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_NOTIFICATION_HIGH)) return E_LAYER_CLIENT_NOTIFICATION_HIGH;
1848 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_NOTIFICATION_TOP)) return E_LAYER_CLIENT_NOTIFICATION_TOP;
1849 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_ALERT_LOW)) return E_LAYER_CLIENT_ALERT_LOW;
1850 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_ALERT)) return E_LAYER_CLIENT_ALERT;
1851 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_ALERT_HIGH)) return E_LAYER_CLIENT_ALERT_HIGH;
1852 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_DRAG)) return E_LAYER_CLIENT_DRAG;
1853 if (!_check_layer_idx(layer_name, E_LAYER_CLIENT_CURSOR)) return E_LAYER_CLIENT_CURSOR;
1854 if (!_check_layer_idx(layer_name, E_LAYER_POPUP)) return E_LAYER_POPUP;
1855 if (!_check_layer_idx(layer_name, E_LAYER_EFFECT)) return E_LAYER_EFFECT;
1856 if (!_check_layer_idx(layer_name, E_LAYER_DESK_OBJECT_BELOW)) return E_LAYER_DESK_OBJECT_BELOW;
1857 if (!_check_layer_idx(layer_name, E_LAYER_DESK_OBJECT)) return E_LAYER_DESK_OBJECT;
1858 if (!_check_layer_idx(layer_name, E_LAYER_DESK_OBJECT_ABOVE)) return E_LAYER_DESK_OBJECT_ABOVE;
1859 if (!_check_layer_idx(layer_name, E_LAYER_MENU)) return E_LAYER_MENU;
1860 if (!_check_layer_idx(layer_name, E_LAYER_DESKLOCK)) return E_LAYER_DESKLOCK;
1861 if (!_check_layer_idx(layer_name, E_LAYER_MAX)) return E_LAYER_MAX;
1863 return E_LAYER_MAX + 1;
1867 _set_win_prop_Layer(Evas_Object *evas_obj, const char *prop_value)
1869 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1871 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1873 layer_idx = _e_comp_layer_idx_get(prop_value);
1874 if (layer_idx == (E_LAYER_MAX + 1))
1875 return strdup("invalid property value");
1877 ec->layer = layer_idx;
1883 _get_win_prop_Layer(const Evas_Object *evas_obj)
1888 char layer_name[48] = {0,};
1890 ec = evas_object_data_get(evas_obj, "E_Client");
1891 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1892 e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name));
1894 if (asprintf(&str, "[%d, %s]", ec->layer, layer_name) < 0)
1901 _get_win_prop_Shape_input(const Evas_Object *evas_obj)
1907 ec = evas_object_data_get(evas_obj, "E_Client");
1908 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1910 if (!ec->shape_input_rects || ec->shape_input_rects_num <= 0)
1911 return strdup("None");
1913 for (i = 0 ; i < ec->shape_input_rects_num ; ++i)
1914 astrcat_(&str, "[%d,%d,%d,%d]\n", ec->shape_input_rects[i].x, ec->shape_input_rects[i].y,
1915 ec->shape_input_rects[i].w, ec->shape_input_rects[i].h);
1925 _get_win_prop_Shape_rects(const Evas_Object *evas_obj)
1931 ec = evas_object_data_get(evas_obj, "E_Client");
1932 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1934 if (!ec->shape_rects || ec->shape_rects_num <= 0)
1935 return strdup("None");
1937 for (i = 0 ; i < ec->shape_rects_num ; ++i)
1938 astrcat_(&str, "[%d,%d,%d,%d]\n", ec->shape_rects[i].x, ec->shape_rects[i].y,
1939 ec->shape_rects[i].w, ec->shape_rects[i].h);
1949 _get_win_prop_Transients(const Evas_Object *evas_obj)
1954 const E_Client *child;
1957 ec = evas_object_data_get(evas_obj, "E_Client");
1958 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1960 if (!ec->transients)
1961 return strdup("None");
1963 EINA_LIST_FOREACH(ec->transients, l, child)
1964 astrcat_(&str, "0x%zx, ", e_client_util_win_get(child));
1974 _get_win_prop_ParentWindowID(const Evas_Object *evas_obj)
1979 ec = evas_object_data_get(evas_obj, "E_Client");
1980 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
1983 return strdup("None");
1985 if (asprintf(&str, "0x%zx", e_client_util_win_get(ec->parent)) < 0)
1992 _set_win_prop_Geometry(Evas_Object *evas_obj, const char *prop_value)
1994 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
1995 int x = -1, y = -1, w = -1, h = -1;
1998 ret = sscanf(prop_value, "%d, %d %dx%d", &x, &y, &w, &h);
1999 EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == 4, (strdup("Invalid format")));
2001 if (x < 0 || y < 0 || w <= 0 || h <= 0)
2002 return strdup("invalid property value");
2004 /* TODO: I have no enough knowledges to say that it's a proper way
2005 * to change e_client geometry */
2006 e_client_pos_set(ec, x, y);
2007 e_client_size_set(ec, w, h);
2013 _get_win_prop_Geometry(const Evas_Object *evas_obj)
2018 ec = evas_object_data_get(evas_obj, "E_Client");
2019 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2021 if (asprintf(&str, "[%d, %d %dx%d]", ec->x, ec->y, ec->w, ec->h) < 0)
2028 _get_win_prop_Min_size(const Evas_Object *evas_obj)
2033 ec = evas_object_data_get(evas_obj, "E_Client");
2034 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2036 if (asprintf(&str, "%dx%d", ec->icccm.min_w, ec->icccm.min_h) < 0)
2043 _get_win_prop_Max_size(const Evas_Object *evas_obj)
2048 ec = evas_object_data_get(evas_obj, "E_Client");
2049 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2051 if (asprintf(&str, "%dx%d", ec->icccm.max_w, ec->icccm.max_h) < 0)
2058 _set_win_prop_Role(Evas_Object *evas_obj, const char *prop_value)
2060 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
2062 e_client_window_role_set(ec, prop_value);
2068 _get_win_prop_Role(const Evas_Object *evas_obj)
2073 ec = evas_object_data_get(evas_obj, "E_Client");
2074 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2076 if (asprintf(&str, "%s", ec->icccm.window_role ?: "NO ROLE") < 0)
2083 _set_win_prop_Window_Name(Evas_Object *evas_obj, const char *prop_value)
2085 E_Client *ec = evas_object_data_get(evas_obj, "E_Client");
2086 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2088 /* TODO: I ain't sure it's a proper order */
2090 eina_stringshare_replace(&ec->netwm.name, prop_value);
2091 else if (ec->icccm.title)
2092 eina_stringshare_replace(&ec->icccm.title, prop_value);
2094 eina_stringshare_replace(&ec->netwm.name, prop_value);
2100 _get_win_prop_Window_Name(const Evas_Object *evas_obj)
2105 ec = evas_object_data_get(evas_obj, "E_Client");
2107 if (asprintf(&str, "%s", e_client_util_name_get(ec) ?: "NO NAME") < 0)
2114 _get_win_prop_ResourceID(const Evas_Object *evas_obj)
2119 ec = evas_object_data_get(evas_obj, "E_Client");
2120 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2123 return strdup("None");
2125 if (asprintf(&str, "%d", e_pixmap_res_id_get(ec->pixmap)) < 0)
2132 _get_win_prop_PID(const Evas_Object *evas_obj)
2138 ec = evas_object_data_get(evas_obj, "E_Client");
2139 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
2143 const E_Comp_Wl_Client_Data *cdata = (const E_Comp_Wl_Client_Data*)ec->comp_data;
2145 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
2148 if (asprintf(&str, "%d", pid) < 0)
2155 _get_win_prop_Window_ID(const Evas_Object *evas_obj)
2160 ec = evas_object_data_get(evas_obj, "E_Client");
2162 if (asprintf(&str, "0x%zx", e_client_util_win_get(ec)) < 0)
2168 typedef const char* (*get_prop_t)(const Evas_Object *evas_obj);
2169 typedef const char* (*set_prop_t)(Evas_Object *evas_obj, const char *prop_value);
2171 static struct property_manager
2173 const char* prop_name;
2178 * evas_obj - an evas_obj (which is e_client) a property value has to be got for
2179 * return nullptr in case of an error, property value string otherwise
2181 * property value string should be freed with free() when it's no longer needed
2183 * can be nullptr if this property isn't getable */
2184 get_prop_t get_prop;
2189 * evas_obj - an evas_obj (which is e_client) a property value has to be set for
2190 * prop_value - a value of property to set
2191 * return pointer to an error string in case of an error, nullptr otherwise
2193 * error string should be freed with free() when it's no longer needed
2194 * it's this function responsibility to check property_value sanity
2196 * can be nullptr if this property isn't setable */
2197 set_prop_t set_prop;
2198 } win_properties[] =
2202 _get_win_prop_Window_ID,
2212 _get_win_prop_ResourceID,
2217 _get_win_prop_Window_Name,
2218 _set_win_prop_Window_Name
2227 _get_win_prop_Geometry,
2228 _set_win_prop_Geometry
2232 _get_win_prop_Min_size,
2237 _get_win_prop_Max_size,
2242 _get_win_prop_ParentWindowID,
2247 _get_win_prop_Transients,
2252 _get_win_prop_Shape_rects,
2257 _get_win_prop_Shape_input,
2262 _get_win_prop_Layer,
2267 _get_win_prop_Visible,
2268 _set_win_prop_Visible
2272 _get_win_prop_32bit,
2277 _get_win_prop_Hidden,
2278 _set_win_prop_Hidden
2282 _get_win_prop_Moving,
2287 _get_win_prop_Focused,
2288 _set_win_prop_Focused
2292 _get_win_prop_Iconic,
2293 _set_win_prop_Iconic
2297 _get_win_prop_Sticky,
2298 _set_win_prop_Sticky
2302 _get_win_prop_Fullscreen,
2303 _set_win_prop_Fullscreen
2307 _get_win_prop_Re_manage,
2312 _get_win_prop_Accept_focus,
2317 _get_win_prop_Take_focus,
2322 _get_win_prop_Want_focus,
2326 "E_Maximize_Policy",
2327 _get_win_prop_E_Maximize_Policy,
2331 "E_FullScreen_Policy",
2332 _get_win_prop_E_FullScreen_Policy,
2336 "E_Transient_Policy",
2337 _get_win_prop_E_Transient_Policy,
2342 _get_win_prop_Override,
2347 _get_win_prop_Input_only,
2352 _get_win_prop_Dialog,
2357 _get_win_prop_Redirected,
2358 _set_win_prop_Redirected
2362 _get_win_prop_Layer_block,
2367 _get_win_prop_Ignored,
2368 _set_win_prop_Ignored
2371 "Maximize_override",
2372 _get_win_prop_Maximize_override,
2377 _get_win_prop_Transformed,
2382 _get_win_prop_Video_Client,
2387 _get_win_prop_Aux_Hint,
2391 "Subsurface Parent",
2392 _get_win_prop_Subsurface_Parent,
2396 "Subsurface Child List",
2397 _get_win_prop_Subsurface_Child_List,
2401 "Subsurface Below Child List",
2402 _get_win_prop_Subsurface_Below_Child_List,
2407 _get_win_prop_Transform,
2412 _get_win_prop_Rotation,
2417 _get_win_prop_Input_region,
2422 #define __WINDOW_PROP_ARG_APPEND(title, value) ({ \
2423 eldbus_message_iter_arguments_append(iter, "(ss)", &struct_of_ec); \
2424 eldbus_message_iter_arguments_append(struct_of_ec, "ss", (title), (value)); \
2425 eldbus_message_iter_container_close(iter, struct_of_ec);})
2427 static Eldbus_Message*
2428 _msg_fill_out_window_props(const Eldbus_Message *msg, Eldbus_Message_Iter *iter, Evas_Object *evas_obj,
2429 const char *property_name, const char *property_value)
2431 const int win_property_size = sizeof(win_properties)/sizeof(struct property_manager);
2432 Eldbus_Message_Iter* struct_of_ec;
2435 /* accordingly to -prop option rules (if user's provided some property name) */
2436 if (strlen(property_name))
2438 /* check the property_name sanity */
2439 for (idx = 0; idx < win_property_size; ++idx)
2440 if (!strncmp(win_properties[idx].prop_name, property_name, sizeof(win_properties[idx])))
2443 if (idx == win_property_size)
2444 return eldbus_message_error_new(msg, INVALID_PROPERTY_NAME,
2445 "get_window_prop: invalid property name");
2447 /* accordingly to -prop option rules (if user wanna set property) */
2448 if (strlen(property_value))
2450 if (win_properties[idx].set_prop)
2452 /* in case of a success we just return an empty reply message */
2453 const char* error_str = win_properties[idx].set_prop(evas_obj, property_value);
2456 Eldbus_Message* err_msg = eldbus_message_error_new(msg,
2457 FAIL_TO_SET_PROPERTY, error_str);
2458 free((void*)error_str);
2464 return eldbus_message_error_new(msg, FAIL_TO_SET_PROPERTY,
2465 "get_window_prop: this property isn't setable");
2467 else /* if wanna get property */
2469 if (win_properties[idx].get_prop)
2471 const char* res_str = win_properties[idx].get_prop(evas_obj);
2474 __WINDOW_PROP_ARG_APPEND(win_properties[idx].prop_name, res_str);
2475 free((void*)res_str);
2478 return eldbus_message_error_new(msg, FAIL_TO_GET_PROPERTY, "");
2481 return eldbus_message_error_new(msg, FAIL_TO_GET_PROPERTY,
2482 "get_window_prop: this property isn't getable");
2485 else /* if user wanna get all properties */
2487 /* to improve readability, if user wanna get properties for several windows, some
2488 * delimiter being used */
2489 __WINDOW_PROP_ARG_APPEND("delimiter", "");
2491 for (idx = 0; idx < win_property_size; ++idx)
2493 if (win_properties[idx].get_prop)
2495 const char* res_str = win_properties[idx].get_prop(evas_obj);
2498 __WINDOW_PROP_ARG_APPEND(win_properties[idx].prop_name, res_str);
2499 free((void*)res_str);
2502 return eldbus_message_error_new(msg, FAIL_TO_GET_PROPERTY, "");
2509 #undef __WINDOW_PROP_ARG_APPEND
2512 /* create the reply message and look for window(s) an user wanna get/set property(ies) for */
2513 static Eldbus_Message *
2514 _msg_window_prop_append(const Eldbus_Message *msg, uint32_t mode, const char *value,
2515 const char *property_name, const char *property_value)
2517 const static int WINDOW_ID_MODE = 0;
2518 const static int WINDOW_PID_MODE = 1;
2519 const static int WINDOW_NAME_MODE = 2;
2521 Eldbus_Message_Iter *iter, *array_of_ec;
2522 Eldbus_Message *reply_msg, *error_msg = NULL;
2525 unsigned long tmp = 0;
2526 uint64_t value_number = 0;
2527 Eina_Bool res = EINA_FALSE;
2528 Eina_Bool window_exists = EINA_FALSE;
2530 if (mode == WINDOW_ID_MODE || mode == WINDOW_PID_MODE)
2532 if (!value) value_number = 0;
2535 if (strlen(value) >= 2 && value[0] == '0' && value[1] == 'x')
2536 res = e_util_string_to_ulong(value, &tmp, 16);
2538 res = e_util_string_to_ulong(value, &tmp, 10);
2540 if (res == EINA_FALSE)
2542 ERR("get_window_prop: invalid input arguments");
2544 return eldbus_message_error_new(msg, INVALID_ARGS,
2545 "get_window_prop: invalid input arguments");
2547 value_number = (uint64_t)tmp;
2551 /* msg - is a method call message */
2552 reply_msg = eldbus_message_method_return_new(msg);
2553 iter = eldbus_message_iter_get(reply_msg);
2554 eldbus_message_iter_arguments_append(iter, "a(ss)", &array_of_ec);
2556 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
2558 ec = evas_object_data_get(o, "E_Client");
2561 /* here we're dealing with evas objects which are e_client */
2563 if (mode == WINDOW_ID_MODE)
2565 Ecore_Window win = e_client_util_win_get(ec);
2567 if (win == value_number)
2569 window_exists = EINA_TRUE;
2570 error_msg = _msg_fill_out_window_props(msg, array_of_ec, o, property_name, property_value);
2574 else if (mode == WINDOW_PID_MODE)
2579 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
2582 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
2585 if (pid == value_number)
2587 window_exists = EINA_TRUE;
2588 error_msg = _msg_fill_out_window_props(msg, array_of_ec, o, property_name, property_value);
2593 else if (mode == WINDOW_NAME_MODE)
2595 const char *name = e_client_util_name_get(ec) ?: "NO NAME";
2597 if (name != NULL && value != NULL)
2599 const char *find = strstr(name, value);
2603 window_exists = EINA_TRUE;
2604 error_msg = _msg_fill_out_window_props(msg, array_of_ec, o, property_name, property_value);
2612 eldbus_message_iter_container_close(iter, array_of_ec);
2614 if (window_exists == EINA_TRUE && !error_msg)
2617 /* TODO: I'm not sure we gotta do it. But, who's responsible for message freeing if we've not it
2618 * returned to caller(eldbus)? */
2619 eldbus_message_unref(reply_msg);
2621 /* some error while filling out the reply message */
2625 return eldbus_message_error_new(msg, WIN_NOT_EXIST, "get_window_prop: specified window(s) doesn't exist");
2628 static Eldbus_Message *
2629 _e_info_server_cb_scrsaver(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2631 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
2632 E_Info_Cmd_Scrsaver cmd;
2634 Eina_Bool res, enabled;
2637 res = eldbus_message_arguments_get(msg,
2638 SIGNATURE_SCRSAVER_CLIENT,
2641 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
2645 case E_INFO_CMD_SCRSAVER_INFO:
2646 sec = e_screensaver_timeout_get();
2647 enabled = e_screensaver_enabled_get();
2648 snprintf(result, sizeof(result),
2649 "[Server] screen saver\n" \
2651 "\tTimeout period: %lf\n",
2652 enabled ? "Enabled" : "Disabled",
2655 case E_INFO_CMD_SCRSAVER_ENABLE:
2656 e_screensaver_enable();
2657 snprintf(result, sizeof(result),
2658 "[Server] Enabled the screen saver");
2660 case E_INFO_CMD_SCRSAVER_DISABLE:
2661 e_screensaver_disable();
2662 snprintf(result, sizeof(result),
2663 "[Server] Disabled the screen saver");
2665 case E_INFO_CMD_SCRSAVER_TIMEOUT:
2666 e_screensaver_timeout_set(sec);
2667 snprintf(result, sizeof(result),
2668 "[Server] Set timeout period of the screen saver: %lf",
2672 snprintf(result, sizeof(result),
2673 "[Server] Error Unknown cmd(%d) for the screen saver",
2678 eldbus_message_arguments_append(reply,
2679 SIGNATURE_SCRSAVER_SERVER,
2685 static Eldbus_Message *
2686 _e_info_server_cb_window_prop_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2689 const char *value = NULL;
2690 const char *property_name = NULL, *property_value = NULL;
2692 if (!eldbus_message_arguments_get(msg, "usss", &mode, &value, &property_name, &property_value))
2694 ERR("Error getting arguments.");
2696 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
2697 "get_window_prop: an attempt to get arguments from method call message failed");
2700 /* TODO: it's guaranteed, by client logic, that 'value', 'property_name' and 'property_value'
2701 * can be ONLY either empty string or string. Should I check this? <if( !property_name )> */
2702 return _msg_window_prop_append(msg, mode, value, property_name, property_value);
2706 Eldbus_Message *reply;
2712 _image_save_done_cb(void *data, E_Client* ec EINA_UNUSED, const Eina_Stringshare *dest, E_Capture_Save_State state)
2714 Dump_Win_Data *dump = (Dump_Win_Data *)data;
2718 if (state != E_CAPTURE_SAVE_STATE_DONE)
2719 astrcat_(&dump->result_str, "%s FAILED\n", dest ?: "Can't save the file(Already Exists?)");
2721 astrcat_(&dump->result_str, "%s SAVED\n", dest);
2725 eldbus_message_arguments_append(dump->reply, "s", dump->result_str);
2726 eldbus_connection_send(e_info_server.edbus_conn, dump->reply, NULL, NULL, -1);
2727 free(dump->result_str);
2733 free(dump->result_str);
2737 eldbus_message_arguments_append(dump->reply, "s", "Failed to make log message...");
2738 eldbus_connection_send(e_info_server.edbus_conn, dump->reply, NULL, NULL, -1);
2745 static void _e_info_server_cb_wins_dump_topvwins(const char *dir, Eldbus_Message *reply)
2751 char fname[PATH_MAX];
2752 Eina_Stringshare *s_fname, *s_dir;
2753 Eina_List *topvwins = NULL;
2754 Dump_Win_Data *dump = NULL;
2755 E_Capture_Save_State state;
2757 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
2759 ec = evas_object_data_get(o, "E_Client");
2762 if (e_client_util_ignored_get(ec)) continue;
2764 topvwins = eina_list_append(topvwins, ec);
2769 dump = E_NEW(Dump_Win_Data, 1);
2770 EINA_SAFETY_ON_NULL_GOTO(dump, fail);
2772 dump->reply = reply;
2773 dump->num = eina_list_count(topvwins);
2775 s_dir = eina_stringshare_add(dir);
2777 EINA_LIST_FREE(topvwins, ec)
2779 win = e_client_util_win_get(ec);
2781 rotation = ec->comp_data->scaler.buffer_viewport.buffer.transform * 90;
2782 snprintf(fname, sizeof(fname), "0x%08zx_%d", win, rotation);
2784 s_fname = eina_stringshare_add(fname);
2786 state = e_client_image_save(ec, s_dir, s_fname,
2787 _image_save_done_cb, dump, EINA_TRUE);
2789 if (state != E_CAPTURE_SAVE_STATE_START)
2792 eina_stringshare_del(s_fname);
2794 eina_stringshare_del(s_dir);
2800 //no available windows to dump
2804 eldbus_message_arguments_append(reply, "s", "ERR: There are no topvwins.");
2805 eldbus_connection_send(e_info_server.edbus_conn, reply, NULL, NULL, -1);
2810 static void _e_info_server_cb_wins_dump_ns(const char *dir)
2814 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
2818 Evas_Native_Surface *ns = NULL;
2819 Evas_Object *co = NULL; // native surface set
2820 tbm_surface_h tbm_surface = NULL, capturable_tbm_surface = NULL;
2821 char fname[PATH_MAX];
2822 const char *bltin_t = NULL;
2824 ec = evas_object_data_get(o, "E_Client");
2825 win = e_client_util_win_get(ec);
2827 // find obj which have native surface set
2828 bltin_t = evas_object_type_get(o);
2829 if (!e_util_strcmp(bltin_t, "image"))
2831 // builtin types "image" could have cw->obj
2832 ns = evas_object_image_native_surface_get(o);
2838 if (!co) co = evas_object_name_child_find(o, "cw->obj", -1);
2839 if (co) ns = evas_object_image_native_surface_get(co);
2845 Evas_Object *c = NULL;
2847 if (evas_object_smart_smart_get(o) &&
2848 evas_object_smart_data_get(o))
2850 //find smart obj members
2851 EINA_LIST_REVERSE_FOREACH(evas_object_smart_members_get(o), ll, c)
2853 if (!co) co = evas_object_name_child_find(c, "cw->obj", -1);
2854 if (co) ns = evas_object_image_native_surface_get(co);
2864 case EVAS_NATIVE_SURFACE_WL:
2865 snprintf(fname, sizeof(fname), "%s/0x%08zx_wl_%p.png", dir, win, co);
2866 if (!ns->data.wl.legacy_buffer) continue;
2868 tbm_surface = wayland_tbm_server_get_surface(NULL, ns->data.wl.legacy_buffer);
2869 if (!tbm_surface) continue;
2871 capturable_tbm_surface = e_comp_wl_tbm_capturable_buffer_get(tbm_surface);
2872 if (!capturable_tbm_surface) continue;
2874 tdm_helper_dump_buffer(capturable_tbm_surface, fname);
2875 tbm_surface_internal_unref(capturable_tbm_surface);
2877 case EVAS_NATIVE_SURFACE_TBM:
2878 snprintf(fname, sizeof(fname), "%s/0x%08zx_tbm_%p.png", dir, win, co);
2879 if (!ns->data.tbm.buffer) continue;
2881 capturable_tbm_surface = e_comp_wl_tbm_capturable_buffer_get(ns->data.tbm.buffer);
2882 if (!capturable_tbm_surface) continue;
2884 tdm_helper_dump_buffer(capturable_tbm_surface, fname);
2885 tbm_surface_internal_unref(capturable_tbm_surface);
2893 static void _e_info_server_cb_wins_dump_hwc_wins(const char *dir)
2895 E_Comp_Screen *e_comp_screen = NULL;
2896 E_Output *output = NULL;
2897 E_Hwc_Window *hwc_window = NULL;
2899 Eina_List *o = NULL, *oo = NULL;
2900 Eina_List *l = NULL, *ll = NULL;
2902 e_comp_screen = e_comp->e_comp_screen;
2903 if (!e_comp_screen) return;
2905 EINA_LIST_FOREACH_SAFE(e_comp_screen->outputs, o, oo, output)
2907 if (!output) continue;
2908 if (!output->config.enabled) continue;
2909 if (!output->tdm_hwc) continue;
2913 EINA_LIST_FOREACH_SAFE(hwc->hwc_windows, l, ll, hwc_window)
2915 char fname[PATH_MAX];
2917 tbm_surface_h capturable_tbm_surface;
2919 if (!hwc_window) continue;
2920 if (!hwc_window->display.buffer.tsurface) continue;
2922 fmt = tbm_surface_get_format(hwc_window->display.buffer.tsurface);
2925 case TBM_FORMAT_ARGB8888:
2926 case TBM_FORMAT_XRGB8888:
2927 case TBM_FORMAT_ABGR8888:
2928 case TBM_FORMAT_XBGR8888:
2929 if (hwc_window->is_target)
2930 snprintf(fname, sizeof(fname), "compositor_hwin_%p_tbm_%p", hwc_window, hwc_window->display.buffer.tsurface);
2932 snprintf(fname, sizeof(fname), "0x%08zx_hwin_%p_tbm_%p", e_client_util_win_get(hwc_window->ec),
2933 hwc_window, hwc_window->display.buffer.tsurface);
2935 capturable_tbm_surface = e_comp_wl_tbm_capturable_buffer_get(hwc_window->display.buffer.tsurface);
2936 if (!capturable_tbm_surface) continue;
2938 tbm_surface_internal_capture_buffer(capturable_tbm_surface, dir, fname, "png");
2939 tbm_surface_internal_unref(capturable_tbm_surface);
2941 case TBM_FORMAT_YUV420:
2942 case TBM_FORMAT_YVU420:
2943 case TBM_FORMAT_NV12:
2944 case TBM_FORMAT_NV21:
2945 case TBM_FORMAT_YUYV:
2946 case TBM_FORMAT_UYVY:
2947 if (hwc_window->is_target)
2948 snprintf(fname, sizeof(fname), "compositor_hwin_%p_tbm_%p", hwc_window, hwc_window->display.buffer.tsurface);
2950 snprintf(fname, sizeof(fname), "0x%08zx_hwin_%p_tbm_%p", e_client_util_win_get(hwc_window->ec),
2951 hwc_window, hwc_window->display.buffer.tsurface);
2953 capturable_tbm_surface = e_comp_wl_tbm_capturable_buffer_get(hwc_window->display.buffer.tsurface);
2954 if (!capturable_tbm_surface) continue;
2956 tbm_surface_internal_capture_buffer(capturable_tbm_surface, dir, fname, "png");
2957 tbm_surface_internal_unref(capturable_tbm_surface);
2966 static Eldbus_Message *
2967 _e_info_server_cb_wins_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2969 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
2974 if (!eldbus_message_arguments_get(msg, SIGNATURE_DUMP_WINS, &type, &dir))
2976 ERR("Error getting arguments.");
2980 if (!e_util_strcmp(type, "topvwins"))
2982 _e_info_server_cb_wins_dump_topvwins(dir, reply);
2985 else if (!e_util_strcmp(type, "ns"))
2986 _e_info_server_cb_wins_dump_ns(dir);
2987 else if (!e_util_strcmp(type, "hwc_wins"))
2988 _e_info_server_cb_wins_dump_hwc_wins(dir);
2990 snprintf(log, sizeof(log), "path:%s type:%s Dump Completed\n", dir, type);
2991 eldbus_message_arguments_append(reply, "s", log);
2995 static Eldbus_Message *
2996 _e_info_server_cb_force_visible(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
2998 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3004 if (!eldbus_message_arguments_get(msg, SIGNATURE_FORCE_VISIBLE_CLIENT, &obj, &visible))
3006 ERR("Error getting arguments.");
3010 o = (Evas_Object*)((uintptr_t)obj);
3012 ec = evas_object_data_get(o, "E_Client");
3013 if (ec && !e_pixmap_resource_get(ec->pixmap))
3016 snprintf(msg, sizeof msg, "obj(%p) doesn't have valid wl_buffer", o);
3017 eldbus_message_arguments_append(reply, "s", msg);
3022 evas_object_show(o);
3024 evas_object_hide(o);
3029 /* Method Handlers */
3030 static Eldbus_Message *
3031 _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3033 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3034 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
3035 Eldbus_Message_Iter *array_of_ec;
3039 eldbus_message_iter_arguments_append(iter, "a("SIGNATURE_SUBSURFACE")", &array_of_ec);
3042 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
3044 Eldbus_Message_Iter* struct_of_ec;
3045 Ecore_Window win = 0, parent = 0;
3046 unsigned int buf_id = 0;
3047 int x = 0, y = 0, w = 0, h = 0;
3048 unsigned int transform = 0, visible = 0, alpha = 0, ignore = 0, maskobj = 0, video = 0, stand = 0;
3049 Ecore_Window bgrect = 0;
3050 const char *name = NULL;
3051 E_Comp_Wl_Buffer *buffer;
3054 ec = evas_object_data_get(o, "E_Client");
3057 if (!evas_object_visible_get(o)) continue;
3059 name = evas_object_name_get(o);
3060 if (!name) continue;
3061 if (strncmp(name, "below_bg_rectangle", 18)) continue;
3062 win = (Ecore_Window)o;
3063 evas_object_geometry_get(o, &x, &y, &w, &h);
3064 visible = evas_object_visible_get(o);
3068 if (e_object_is_del(E_OBJECT(ec)) || !ec->comp_data) continue;
3069 if (!e_comp_wl_subsurface_check(ec) &&
3070 !ec->comp_data->sub.list && !ec->comp_data->sub.list_pending &&
3071 !ec->comp_data->sub.below_list && !ec->comp_data->sub.below_list_pending)
3073 win = e_client_util_win_get(ec);
3074 if (e_comp_wl_subsurface_check(ec))
3076 parent = e_client_util_win_get(e_comp_wl_subsurface_parent_get(ec));
3077 stand = e_comp_wl_subsurface_stand_alone_mode_get(ec);
3079 buffer = e_pixmap_resource_get(ec->pixmap);
3081 buf_id = (buffer->resource) ? wl_resource_get_id(buffer->resource) : (WAYLAND_SERVER_RESOURCE_ID_MASK & 99999);
3082 map = e_client_map_get(ec);
3085 Evas_Coord x1, x2, y1, y2;
3086 E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport;
3087 e_map_point_coord_get(map, 0, &x1, &y1, NULL);
3088 e_map_point_coord_get(map, 2, &x2, &y2, NULL);
3089 x = x1, y = y1, w = x2 - x1, h = y2 - y1;
3090 transform = vp->buffer.transform;
3093 evas_object_geometry_get(ec->frame, &x, &y, &w, &h);
3095 visible = evas_object_visible_get(o);
3096 alpha = e_comp_object_alpha_get(ec->frame);
3097 ignore = e_client_util_ignored_get(ec);
3098 if (ec->comp_data->sub.below_obj)
3099 bgrect = (Ecore_Window)ec->comp_data->sub.below_obj;
3100 maskobj = e_comp_object_mask_has(ec->frame);
3101 video = (ec->comp_data->video_client || e_client_video_hw_composition_check(ec)) ? 1 : 0;
3102 name = e_client_util_name_get(ec);
3107 eldbus_message_iter_arguments_append(array_of_ec, "("SIGNATURE_SUBSURFACE")", &struct_of_ec);
3109 eldbus_message_iter_arguments_append
3110 (struct_of_ec, SIGNATURE_SUBSURFACE,
3111 win, parent, buf_id, x, y, w, h, transform, visible, alpha, ignore, maskobj, video, stand, bgrect, name);
3113 eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
3116 eldbus_message_iter_container_close(iter, array_of_ec);
3121 static Eldbus_Message *
3122 _e_info_server_cb_eina_log_levels(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3124 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3125 const char *start = NULL;
3128 if (!eldbus_message_arguments_get(msg, "s", &start) || !start)
3130 ERR("Error getting arguments.");
3136 char module_name[256];
3141 end = strchr(start, ':');
3145 // Parse level, keep going if failed
3146 level = (int)strtol((char *)(end + 1), &tmp, 10);
3147 if (tmp == (end + 1))
3151 len = MIN(end - start, (sizeof module_name) - 1);
3152 strncpy(module_name, start, len);
3153 module_name[len] = '\0';
3155 eina_log_domain_level_set((const char*)module_name, level);
3158 start = strchr(tmp, ',');
3168 static Eldbus_Message *
3169 _e_info_server_cb_eina_log_path(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3171 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3172 const char *path = NULL;
3174 if (!eldbus_message_arguments_get(msg, "s", &path) || !path)
3176 ERR("Error getting arguments.");
3180 e_log_path_set(path);
3186 static Eldbus_Message *
3187 _e_info_server_cb_dlog_switch(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3189 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3192 if (!eldbus_message_arguments_get(msg, "i", &onoff))
3194 ERR("Error getting arguments.");
3198 if ((onoff == 1) || (onoff == 0))
3199 e_log_dlog_enable(onoff);
3205 static Eldbus_Message *
3206 _e_info_server_cb_rotation_query(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3208 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3210 /* TODO: need implementation */
3216 _e_info_event_rotation_free(void *data EINA_UNUSED, void *event)
3218 E_Event_Info_Rotation_Message *ev = event;
3220 e_object_unref(E_OBJECT(ev->zone));
3224 static Eldbus_Message *
3225 _e_info_server_cb_rotation_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3227 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3228 E_Event_Info_Rotation_Message *ev;
3229 E_Info_Rotation_Message rot_msg;
3235 if (!eldbus_message_arguments_get(msg, "iii", &rot_msg, &zone_num, &rval))
3237 ERR("Error getting arguments.");
3241 if (rot_msg == E_INFO_ROTATION_MESSAGE_SET)
3243 /* check if rval is valid */
3244 if ((rval > 270) || (rval % 90 != 0))
3248 ev = E_NEW(E_Event_Info_Rotation_Message, 1);
3249 if (EINA_UNLIKELY(!ev))
3251 ERR("Failed to allocate ""E_Event_Info_Rotation_Message""");
3256 ev->zone = e_zone_current_get();
3259 EINA_LIST_FOREACH(e_comp->zones, l, z)
3261 if (z->num == zone_num)
3268 ERR("Failed to found zone by given num: num %d", zone_num);
3273 e_object_ref(E_OBJECT(ev->zone));
3274 ev->message = rot_msg;
3275 ev->rotation = rval;
3277 ecore_event_add(E_EVENT_INFO_ROTATION_MESSAGE, ev, _e_info_event_rotation_free, NULL);
3283 protocol_cb_client_destroy(struct wl_listener *listener, void *data)
3285 struct wl_client *wc = (struct wl_client *)data;
3288 pid_t client_pid = -1;
3289 const char *client_name = NULL;
3290 E_Comp_Connected_Client_Info *cinfo;
3292 char strbuf[512], *str_buff = strbuf;
3296 str_r = sizeof(strbuf);
3298 wl_client_get_credentials(wc, &client_pid, NULL, NULL);
3300 clock_gettime(CLOCK_MONOTONIC, &tp);
3301 time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
3303 EINA_LIST_FOREACH(e_comp->connected_clients, l, cinfo)
3305 if (cinfo->pid == client_pid)
3307 client_name = cinfo->name;
3312 BUF_SNPRINTF("[%10.3f] Server [PID:%d] client destroying", time / 1000.0, client_pid);
3313 BUF_SNPRINTF(", cmd: %s", client_name ? client_name : "cmd is NULL");
3316 fprintf(log_fp_ptrace, "%s\n", strbuf);
3320 wl_list_remove(&listener->link);
3325 protocol_client_destroy_listener_reg(struct wl_client *client)
3327 struct wl_listener *destroy_listener;
3329 destroy_listener = wl_client_get_destroy_listener(client, protocol_cb_client_destroy);
3330 if (destroy_listener) return;
3332 destroy_listener = E_NEW(struct wl_listener, 1);
3333 EINA_SAFETY_ON_NULL_RETURN(destroy_listener);
3335 destroy_listener->notify = protocol_cb_client_destroy;
3336 wl_client_add_destroy_listener(client, destroy_listener);
3339 /* wayland private function */
3341 get_next_argument(const char *signature, struct argument_details *details)
3343 details->nullable = 0;
3344 for(; *signature; ++signature)
3356 details->type = *signature;
3357 return signature + 1;
3359 details->nullable = 1;
3362 details->type = '\0';
3367 _e_info_server_protocol_debug_func2(void *user_data, enum wl_protocol_logger_type direction, const struct wl_protocol_logger_message *message)
3370 struct argument_details arg;
3371 struct wl_client *wc = wl_resource_get_client(message->resource);
3372 const char *signature = message->message->signature;
3375 pid_t client_pid = -1;
3376 E_Comp_Connected_Client_Info *cinfo;
3378 char strbuf[512], *str_buff = strbuf;
3382 str_r = sizeof(strbuf);
3386 protocol_client_destroy_listener_reg(wc);
3387 wl_client_get_credentials(wc, &client_pid, NULL, NULL);
3390 clock_gettime(CLOCK_MONOTONIC, &tp);
3391 time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
3393 E_Info_Protocol_Log elog = {0,};
3394 elog.type = (direction == WL_PROTOCOL_LOGGER_EVENT)?1:0;
3395 elog.client_pid = client_pid;
3396 elog.target_id = wl_resource_get_id(message->resource);
3397 snprintf(elog.name, PATH_MAX, "%s:%s", wl_resource_get_class(message->resource), message->message->name);
3398 EINA_LIST_FOREACH(e_comp->connected_clients, l, cinfo)
3400 if (cinfo->pid == client_pid)
3401 snprintf(elog.cmd, PATH_MAX, "%s", cinfo->name);
3404 if (!e_info_protocol_rule_validate(&elog)) return;
3405 BUF_SNPRINTF("[%10.3f] %s%d%s%s@%u.%s(",
3407 elog.type ? "Server -> Client [PID:" : "Server <- Client [PID:",
3409 wl_resource_get_class(message->resource),
3410 wl_resource_get_id(message->resource),
3411 message->message->name);
3413 for (i = 0; i < message->arguments_count; i++)
3415 signature = get_next_argument(signature, &arg);
3416 if (i > 0) BUF_SNPRINTF(", ");
3421 BUF_SNPRINTF("%u", message->arguments[i].u);
3424 BUF_SNPRINTF("%d", message->arguments[i].i);
3428 wl_fixed_to_double(message->arguments[i].f));
3431 BUF_SNPRINTF("\"%s\"", message->arguments[i].s);
3434 if (message->arguments[i].o)
3435 BUF_SNPRINTF("%s@%u",
3436 wl_resource_get_class((struct wl_resource*)message->arguments[i].o),
3437 wl_resource_get_id((struct wl_resource*)message->arguments[i].o));
3439 BUF_SNPRINTF("nil");
3442 BUF_SNPRINTF("new id %s@", (message->message->types[i]) ? message->message->types[i]->name : "[unknown]");
3443 if (message->arguments[i].n != 0)
3444 BUF_SNPRINTF("%u", message->arguments[i].n);
3446 BUF_SNPRINTF("nil");
3449 BUF_SNPRINTF("array");
3452 BUF_SNPRINTF("fd %d", message->arguments[i].h);
3457 BUF_SNPRINTF("), cmd: %s", elog.cmd ? elog.cmd : "cmd is NULL");
3460 fprintf(log_fp_ptrace, "%s\n", strbuf);
3465 static Eldbus_Message *
3466 _e_info_server_cb_protocol_trace(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3468 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3469 const char *path = NULL;
3471 if (!eldbus_message_arguments_get(msg, "s", &path) || !path)
3473 ERR("Error getting arguments.");
3477 if (log_fp_ptrace != NULL)
3479 fclose(log_fp_ptrace);
3480 log_fp_ptrace = NULL;
3483 if (!strncmp(path, "disable", 7))
3485 if (e_info_protocol_logger)
3487 wl_protocol_logger_destroy(e_info_protocol_logger);
3488 e_info_protocol_logger = NULL;
3493 /* if path's not elog, we open the new log file. Otherwise, the log will be printed via eina_log */
3494 if (strncmp(path, "elog", 4))
3496 log_fp_ptrace = fopen(path, "a");
3499 ERR("failed: open file(%s)\n", path);
3502 setvbuf(log_fp_ptrace, NULL, _IOLBF, 512);
3505 if (e_info_protocol_logger)
3507 wl_protocol_logger_destroy(e_info_protocol_logger);
3508 e_info_protocol_logger = NULL;
3510 e_info_protocol_logger = wl_display_add_protocol_logger(e_comp->wl_comp_data->wl.disp, _e_info_server_protocol_debug_func2, NULL);
3515 static Eldbus_Message *
3516 _e_info_server_cb_protocol_rule(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3518 Eldbus_Message *reply_msg = eldbus_message_method_return_new(msg);
3520 int len = sizeof (reply);
3524 if (!eldbus_message_arguments_get(msg, "sss", &argv[0], &argv[1], &argv[2]) || !argv[0] || !argv[1] || !argv[2])
3526 ERR("Error getting arguments.");
3530 if ((eina_streq(argv[0], "remove") || eina_streq(argv[0], "file")) && eina_streq(argv[2], "no_data"))
3532 if ((eina_streq(argv[0], "print") || eina_streq(argv[0], "help")) && eina_streq(argv[1], "no_data") && eina_streq(argv[2], "no_data"))
3535 e_info_protocol_rule_set(argc, (const char**)&(argv[0]), reply, &len);
3537 eldbus_message_arguments_append(reply_msg, "s", reply);
3542 static Eldbus_Message *
3543 _e_info_server_cb_keymap_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3545 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3547 eldbus_message_arguments_append(reply, "hi", e_comp_input_key->xkb.fd, e_comp_input_key->xkb.size);
3552 _e_info_server_module_hook_call(const char *module_name, const char *log_path)
3557 EINA_LIST_FOREACH(module_hook, l, data)
3559 if (!strncmp(data->module_name, module_name, strlen(module_name)))
3561 data->func(data->data, log_path);
3568 _e_info_server_module_hook_cleanup(void)
3572 EINA_LIST_FREE(module_hook, hdata)
3574 eina_stringshare_del(hdata->module_name);
3579 /* a hook with given name(module_name) is defined by plug-in modules*/
3581 e_info_server_hook_set(const char *module_name, E_Info_Hook_Cb func, void *data)
3583 Eina_List *l, *l_next;
3584 E_Info_Hook *hdata, *ndata;
3586 EINA_SAFETY_ON_NULL_RETURN(module_name);
3588 EINA_LIST_FOREACH_SAFE(module_hook, l, l_next, hdata)
3590 if (!strncmp(hdata->module_name, module_name, strlen(module_name)))
3594 eina_stringshare_del(hdata->module_name);
3596 module_hook = eina_list_remove_list(module_hook, l);
3607 ndata = E_NEW(E_Info_Hook, 1);
3608 EINA_SAFETY_ON_NULL_RETURN(ndata);
3610 ndata->module_name = eina_stringshare_add(module_name);
3614 module_hook = eina_list_append(module_hook, ndata);
3617 static Eldbus_Message *
3618 _e_info_server_cb_module_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3620 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3621 const char *path = NULL, *module_name = NULL;
3623 if (!eldbus_message_arguments_get(msg, "ss", &module_name, &path) || !module_name || !path)
3625 ERR("Error getting arguments.");
3629 _e_info_server_module_hook_call(module_name, path);
3634 static Eldbus_Message *
3635 _e_info_server_cb_keygrab_status_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3637 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3638 const char *path = NULL;
3640 if (!eldbus_message_arguments_get(msg, "s", &path) || !path)
3642 ERR("Error getting arguments.");
3646 _e_info_server_module_hook_call("keygrab", path);
3651 static Eldbus_Message *
3652 _e_info_server_cb_bgcolor_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3656 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3658 EINA_SAFETY_ON_NULL_RETURN_VAL(reply, NULL);
3660 if (!eldbus_message_arguments_get(msg, "iiii", &a, &r, &g, &b))
3662 ERR("Error on getting argument from the given message.");
3666 evas_object_color_get(e_comp->bg_blank_object, &pa, &pr, &pg, &pb);
3667 evas_object_color_set(e_comp->bg_blank_object, r, g, b, a);
3669 INF("The background color of bg_blank_object has been changed.");
3670 INF("(A, R, G, B) : %d, %d, %d, %d -> %d, %d, %d, %d", pa, pr, pg, pb, a, r, g, b);
3675 static Eldbus_Message *
3676 _e_info_server_cb_punch(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3678 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3679 int onoff = 0, x = 0, y = 0, w = 0, h = 0;
3680 int a = 0, r = 0, g = 0, b = 0;
3682 if (!eldbus_message_arguments_get(msg, "iiiiiiiii", &onoff, &x, &y, &w, &h, &a, &r, &g, &b))
3684 ERR("Error getting arguments.");
3689 e_video_debug_screen_punch_set(x, y, w, h, a, r, g, b);
3691 e_video_debug_screen_punch_unset();
3696 static Eldbus_Message *
3697 e_info_server_cb_transform_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3699 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3700 uint32_t enable, transform_id;
3701 uint32_t x, y, sx, sy, degree;
3702 uint32_t background;
3703 unsigned long tmp = 0;
3704 const char *value = NULL;
3705 uint64_t value_number = 0;
3708 Eina_Bool res = EINA_FALSE;
3709 const char *role = NULL;
3711 if (!eldbus_message_arguments_get(msg, "siiiiiiiis", &value, &transform_id, &enable, &x, &y, &sx, &sy, °ree, &background, &role))
3713 ERR("Error getting arguments.");
3717 if (strlen(value) >= 2 && value[0] == '0' && value[1] == 'x')
3718 res = e_util_string_to_ulong(value, &tmp, 16);
3720 res = e_util_string_to_ulong(value, &tmp, 10);
3722 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
3724 value_number = (uint64_t)tmp;
3726 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
3728 ec = evas_object_data_get(o, "E_Client");
3730 E_Info_Transform *transform_info;
3734 win = e_client_util_win_get(ec);
3736 if (win != value_number) continue;
3737 transform_info = _e_info_transform_find(ec, transform_id);
3741 _e_info_transform_set(transform_info, enable, x, y, sx, sy, degree);
3744 _e_info_transform_del_with_id(ec, transform_id);
3750 _e_info_transform_new(ec, transform_id, enable, x, y, sx, sy, degree, background, role);
3760 static Eldbus_Message *
3761 _e_info_server_cb_desktop_geometry_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3763 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3768 if (!eldbus_message_arguments_get(msg, "iiii", &x, &y, &w, &h))
3770 ERR("Error getting arguments.");
3774 if ((w < 0) || (h < 0))
3776 ERR("Error: Invalid parameter w %d h %d", w, h);
3780 zone = e_zone_current_get();
3781 desk = e_desk_current_get(zone);
3782 e_desk_geometry_set(desk, x, y, w, h);
3787 static Eldbus_Message *
3788 _e_info_server_cb_desktop_window_control(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3790 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3795 if (!eldbus_message_arguments_get(msg, "i", &option))
3797 ERR("Error getting arguments.");
3801 zone = e_zone_current_get();
3802 desk = e_desk_current_get(zone);
3804 if (option == 0) // all iconify
3806 ELOGF("TEST", "Iconify Visible Windows", NULL);
3807 e_desk_visible_client_iconify_all(desk);
3809 else if (option == 1) // restore
3811 ELOGF("TEST", "Restore Iconified Windows", NULL);
3812 e_desk_visible_client_restore_all(desk);
3814 else if (option == 2) // clear iconify list
3816 ELOGF("TEST", "Clear Iconified Windows List", NULL);
3817 e_desk_visible_client_iconified_list_remove_all(desk);
3819 else if (option == 3) // toggle
3821 Eina_List *iconified_list = e_desk_visible_client_iconified_list_get(desk);
3824 ELOGF("TEST", "Toggle. Restore Iconified Windows", NULL);
3825 e_desk_visible_client_restore_all(desk);
3829 ELOGF("TEST", "Toggle. Iconify Visible Windows", NULL);
3830 e_desk_visible_client_iconify_all(desk);
3837 static Eldbus_Message *
3838 _e_info_server_cb_desk_zoom(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3840 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3846 if (!eldbus_message_arguments_get(msg, "ddii", &zx, &zy, &cx, &cy))
3848 ERR("Error getting arguments.");
3852 zone = e_zone_current_get();
3853 desk = e_desk_current_get(zone);
3855 if ((zx != 1.0) || (zy != 1.0))
3856 e_desk_zoom_set(desk, zx, zy, cx, cy);
3858 e_desk_zoom_unset(desk);
3863 #ifdef REFACTOR_DESK_AREA
3865 static E_Desk_Area *_edg_sub1 = NULL;
3866 static E_Desk_Area *_edg_sub2 = NULL;
3869 static Eldbus_Message *
3870 _e_info_server_cb_desk_area_info(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3872 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3874 #ifdef REFACTOR_DESK_AREA
3879 zone = e_zone_current_get();
3880 desk = e_desk_current_get(zone);
3882 e_desk_desk_area_info_print(desk);
3888 static Eldbus_Message *
3889 _e_info_server_cb_desk_area_enable(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3891 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3892 #ifdef REFACTOR_DESK_AREA
3896 if (!eldbus_message_arguments_get(msg, "i", &enable))
3898 ERR("Error getting arguments.");
3904 e_desk_desk_area_enable(e_desk_current_get(e_zone_current_get()));
3906 else if (enable == 0)
3908 e_desk_desk_area_disable(e_desk_current_get(e_zone_current_get()));
3914 #ifdef REFACTOR_DESK_AREA
3916 static void _desk_area_new(int sub_edg_id, int x, int y, int w, int h, int layer)
3920 E_Desk_Area_Layer edg_layer;
3922 zone = e_zone_current_get();
3923 desk = e_desk_current_get(zone);
3927 case 0: edg_layer = E_DESK_AREA_LAYER_BACKGROUND; break;
3928 case 1: edg_layer = E_DESK_AREA_LAYER_NORMAL_BELOW; break;
3929 case 2: edg_layer = E_DESK_AREA_LAYER_NORMAL; break;
3930 case 3: edg_layer = E_DESK_AREA_LAYER_NORMAL_ABOVE; break;
3931 case 4: edg_layer = E_DESK_AREA_LAYER_NOTIFICATION_LOW; break;
3932 case 5: edg_layer = E_DESK_AREA_LAYER_NOTIFICATION_NORMAL; break;
3933 case 6: edg_layer = E_DESK_AREA_LAYER_NOTIFICATION_HIGH; break;
3934 default: edg_layer = E_DESK_AREA_LAYER_NORMAL; break;
3937 if (sub_edg_id == 1)
3940 _edg_sub1 = e_desk_desk_area_add(desk, x, y, w, h, edg_layer);
3943 e_desk_area_geometry_set(_edg_sub1, x, y, w, h);
3944 e_desk_area_layer_set(_edg_sub1, edg_layer);
3947 else if (sub_edg_id == 2)
3950 _edg_sub2 = e_desk_desk_area_add(desk, x, y, w, h, edg_layer);
3953 e_desk_area_geometry_set(_edg_sub2, x, y, w, h);
3954 e_desk_area_layer_set(_edg_sub2, edg_layer);
3960 static Eldbus_Message *
3961 _e_info_server_cb_desk_area_new_sub1(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
3963 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
3965 #ifdef REFACTOR_DESK_AREA
3971 Eina_List *ec_list = NULL;
3973 if (!eldbus_message_arguments_get(msg, "iiiii", &x, &y, &w, &h, &layer))
3975 ERR("Error getting arguments.");
3979 _desk_area_new(1, x, y, w, h, layer);
3981 E_CLIENT_REVERSE_FOREACH(ec)
3983 ec_list = eina_list_append(ec_list, ec);
3986 EINA_LIST_REVERSE_FOREACH(ec_list, l, ec)
3988 e_desk_area_ec_reassign(_edg_sub1, ec);
3991 //e_desk_area_all_ec_update(_edg_sub1);
3997 static Eldbus_Message *
3998 _e_info_server_cb_desk_area_new_sub2(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4000 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4002 #ifdef REFACTOR_DESK_AREA
4008 if (!eldbus_message_arguments_get(msg, "iiiii", &x, &y, &w, &h, &layer))
4010 ERR("Error getting arguments.");
4014 _desk_area_new(2, x, y, w, h, layer);
4016 E_CLIENT_FOREACH(ec)
4018 if (e_policy_client_is_home_screen(ec))
4019 e_desk_area_ec_reassign(_edg_sub2, ec);
4020 else if (e_policy_client_is_quickpanel(ec))
4021 e_desk_area_ec_reassign(_edg_sub2, ec);
4028 static Eldbus_Message *
4029 _e_info_server_cb_desk_area_remove_sub(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4031 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4032 #ifdef REFACTOR_DESK_AREA
4034 uint32_t sub_edg_id;
4038 if (!eldbus_message_arguments_get(msg, "i", &sub_edg_id))
4040 ERR("Error getting arguments.");
4044 zone = e_zone_current_get();
4045 desk = e_desk_current_get(zone);
4047 if (sub_edg_id == 1)
4049 e_desk_desk_area_del(desk, _edg_sub1);
4052 else if (sub_edg_id == 2)
4054 e_desk_desk_area_del(desk, _edg_sub2);
4062 _desk_area_raise(E_Desk_Area *eda, uint32_t raise)
4067 zone = e_zone_current_get();
4068 desk = e_desk_current_get(zone);
4072 eda = desk->desk_area.base;
4078 //e_desk_area_raise(eda);
4079 e_desk_desk_area_raise(eda->desk, eda);
4081 else if (raise == 0)
4083 //e_desk_area_lower(eda);
4084 e_desk_desk_area_lower(eda->desk, eda);
4089 static Eldbus_Message *
4090 _e_info_server_cb_desk_area_base_raise(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4092 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4095 if (!eldbus_message_arguments_get(msg, "i", &raise))
4097 ERR("Error getting arguments.");
4101 _desk_area_raise(NULL, raise);
4106 static Eldbus_Message *
4107 _e_info_server_cb_desk_area_sub1_raise(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4109 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4110 #ifdef REFACTOR_DESK_AREA
4114 if (!eldbus_message_arguments_get(msg, "i", &raise))
4116 ERR("Error getting arguments.");
4121 _desk_area_raise(_edg_sub1, raise);
4126 static Eldbus_Message *
4127 _e_info_server_cb_desk_area_sub2_raise(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4129 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4130 #ifdef REFACTOR_DESK_AREA
4134 if (!eldbus_message_arguments_get(msg, "i", &raise))
4136 ERR("Error getting arguments.");
4141 _desk_area_raise(_edg_sub2, raise);
4146 static Eldbus_Message *
4147 _e_info_server_cb_desk_area_check_stack(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4149 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4152 E_Desk_Area *eda = NULL;
4155 Eina_List *edg_ecs_list = NULL;
4160 Eina_Bool mis_match = EINA_FALSE;
4162 zone = e_zone_current_get();
4163 desk = e_desk_current_get(zone);
4166 ELOGF("EDG_TEST", "No current Desk_Area at a current Zoen... return", NULL);
4170 if (!desk->desk_area.enable)
4172 ELOGF("EDG_TEST", "Desk_Area is not enable... return", NULL);
4176 for (i=E_DESK_AREA_LAYER_COUNT-1; i>=0; i--)
4178 EINA_LIST_FOREACH(desk->desk_area.list[i], l, eda)
4180 for (j=E_DESK_AREA_CLIENT_LAYER_MAX-1; j>=0; j--)
4182 EINA_LIST_FOREACH(eda->ec_lists[j], ll, edg_ec)
4184 edg_ecs_list = eina_list_append(edg_ecs_list, edg_ec);
4190 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
4192 ec = evas_object_data_get(o, "E_Client");
4195 edg_ec = eina_list_nth(edg_ecs_list, 0);
4198 ELOGF("EDG_TEST", "BAD.BAD.BAD... NOT MATCHED!!! edg_ec(win:0x%08zx, ec:%p)", ec, e_client_util_win_get(edg_ec), edg_ec);
4199 mis_match = EINA_TRUE;
4201 edg_ecs_list = eina_list_remove(edg_ecs_list, edg_ec);
4205 ELOGF("EDG_TEST", "No error. STACK is MATCHED!!!", NULL);
4207 ELOGF("EDG_TEST", "Error. STACK is NOT MATCHED!!!", NULL);
4213 _e_info_server_cb_buffer_change(void *data, int type, void *event)
4216 E_Event_Client *ev = event;
4217 Ecore_Window event_win;
4218 char fname[PATH_MAX];
4219 E_Comp_Wl_Buffer *buffer;
4220 tbm_surface_h tbm_surface, capturable_tbm_surface;
4221 struct wl_shm_buffer *shmbuffer = NULL;
4223 int stride, w, h, rotation, row, col;
4224 char *name, *parsing_name = NULL, *parsing, *tmp;
4226 EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
4227 EINA_SAFETY_ON_NULL_RETURN_VAL(ev->ec, ECORE_CALLBACK_PASS_ON);
4230 if (e_object_is_del(E_OBJECT(ec)))
4232 ERR("%s: e_object_is_del(E_OBJECT(ec) return\n", __func__);
4233 return ECORE_CALLBACK_PASS_ON;
4235 if (e_client_util_ignored_get(ec))
4237 if (!e_info_dump_remote_surface || !ec->remote_surface.provider)
4239 ERR("%s: e_client_util_ignored_get(ec) true. return\n", __func__);
4240 return ECORE_CALLBACK_PASS_ON;
4244 if ((e_info_dump_win_id) && (e_info_dump_win_id != e_client_util_win_get(ec)))
4245 return ECORE_CALLBACK_PASS_ON;
4247 buffer = e_pixmap_resource_get(ec->pixmap);
4248 if (!buffer) return ECORE_CALLBACK_PASS_ON;
4250 rotation = ec->comp_data->scaler.buffer_viewport.buffer.transform * 90;
4252 event_win = e_client_util_win_get(ec);
4253 name = eina_strdup(e_client_util_name_get(ec));
4256 parsing_name = name;
4257 parsing = strtok_r(name, "/", &tmp);
4258 while(parsing != NULL)
4260 parsing_name = parsing;
4261 parsing = strtok_r(NULL, "/", &tmp);
4265 switch (buffer->type)
4267 case E_COMP_WL_BUFFER_TYPE_SHM:
4268 snprintf(fname, sizeof(fname), "buffer_commit_shm_0x%08zx_%s_%d",
4269 event_win, parsing_name ? parsing_name : "NO_NAME", rotation);
4271 case E_COMP_WL_BUFFER_TYPE_NATIVE:
4272 snprintf(fname, sizeof(fname), "buffer_commit_native_0x%08zx_%s_%d",
4273 event_win, parsing_name ? parsing_name : "NO_NAME", rotation);
4275 case E_COMP_WL_BUFFER_TYPE_VIDEO:
4276 snprintf(fname, sizeof(fname), "buffer_commit_video_0x%08zx_%s_%d",
4277 event_win, parsing_name ? parsing_name : "NO_NAME", rotation);
4279 case E_COMP_WL_BUFFER_TYPE_TBM:
4280 snprintf(fname, sizeof(fname), "buffer_commit_tbm_0x%08zx_%s_%d",
4281 event_win, parsing_name ? parsing_name : "NO_NAME", rotation);
4284 snprintf(fname, sizeof(fname), "buffer_commit_none_0x%08zx_%s_%d",
4285 event_win, parsing_name ? parsing_name : "NO_NAME", rotation);
4289 if (name) free(name);
4291 switch (buffer->type)
4293 case E_COMP_WL_BUFFER_TYPE_SHM:
4294 shmbuffer = wl_shm_buffer_get(buffer->resource);
4295 EINA_SAFETY_ON_NULL_RETURN_VAL(shmbuffer, ECORE_CALLBACK_PASS_ON);
4297 ptr = wl_shm_buffer_get_data(shmbuffer);
4298 EINA_SAFETY_ON_NULL_RETURN_VAL(ptr, ECORE_CALLBACK_PASS_ON);
4300 stride = wl_shm_buffer_get_stride(shmbuffer);
4302 h = wl_shm_buffer_get_height(shmbuffer);
4303 tbm_surface_internal_dump_shm_buffer(ptr, w, h, stride, fname);
4305 case E_COMP_WL_BUFFER_TYPE_NATIVE:
4306 case E_COMP_WL_BUFFER_TYPE_VIDEO:
4307 case E_COMP_WL_BUFFER_TYPE_TBM:
4308 tbm_surface = buffer->tbm_surface;
4309 EINA_SAFETY_ON_NULL_RETURN_VAL(tbm_surface, ECORE_CALLBACK_PASS_ON);
4311 capturable_tbm_surface = e_comp_wl_tbm_capturable_buffer_get(tbm_surface);
4312 EINA_SAFETY_ON_NULL_RETURN_VAL(capturable_tbm_surface, ECORE_CALLBACK_PASS_ON);
4314 if (e_info_dump_mark)
4316 unsigned int colors[5] = {0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFF00FFFF, 0xFFFF00FF};
4319 int box = e_info_dump_mark_count * box_size;
4321 w = tbm_surface_get_width(capturable_tbm_surface);
4322 h = tbm_surface_get_height(capturable_tbm_surface);
4324 EINA_SAFETY_ON_FALSE_RETURN_VAL((w > 0), ECORE_CALLBACK_PASS_ON);
4325 EINA_SAFETY_ON_FALSE_RETURN_VAL((h > 0), ECORE_CALLBACK_PASS_ON);
4327 row = (((box / w) * box_size) % h);
4335 tdm_helper_clear_buffer_color(capturable_tbm_surface, &pos, colors[e_info_dump_mark_count % 5]);
4336 e_info_dump_mark_count++;
4339 tbm_surface_internal_dump_buffer(capturable_tbm_surface, fname);
4340 tbm_surface_internal_unref(capturable_tbm_surface);
4343 DBG("Unknown type resource:%u", wl_resource_get_id(buffer->resource));
4346 DBG("%s dump excute\n", fname);
4348 return ECORE_CALLBACK_PASS_ON;
4352 _e_info_server_dump_directory_make(const char *path)
4360 buf = calloc (1, sizeof (struct tm));
4361 EINA_SAFETY_ON_NULL_RETURN_VAL(buf, NULL);
4362 t = localtime_r(&timer, buf);
4366 ERR("fail to get local time\n");
4370 fullpath = (char *)calloc(1, PATH_MAX * sizeof(char));
4374 ERR("fail to alloc pathname memory\n");
4378 snprintf(fullpath, PATH_MAX, "%s/dump_%04d%02d%02d.%02d%02d%02d", path,
4379 t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
4383 if ((mkdir(fullpath, 0755)) < 0)
4385 ERR("%s: mkdir '%s' fail\n", __func__, fullpath);
4393 static Eldbus_Message *
4394 _e_info_server_cb_buffer_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4396 Eldbus_Message *reply;
4399 const char *path = NULL, *win_id_s = NULL;
4400 unsigned long tmp = 0;
4404 if (!eldbus_message_arguments_get(msg, "iisdis", &start, &count, &path, &scale, &e_info_dump_mark, &win_id_s))
4406 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
4407 "dump_buffers: an attempt to get arguments from method call message failed");
4410 reply = eldbus_message_method_return_new(msg);
4414 if (e_info_dump_running == 1)
4416 eldbus_message_arguments_append(reply, "is", 0, (e_info_dump_path ?: "nopath"));
4420 if (e_util_strcmp(win_id_s, ""))
4422 if (!e_util_strcmp(win_id_s, "server"))
4423 e_info_dump_server_or_client = 1;
4424 else if (!e_util_strcmp(win_id_s, "client"))
4425 e_info_dump_server_or_client = 2;
4428 if (strlen(win_id_s) >= 2 && win_id_s[0] == '0' && win_id_s[1] == 'x')
4429 ret = e_util_string_to_ulong(win_id_s, &tmp, 16);
4431 ret = e_util_string_to_ulong(win_id_s, &tmp, 10);
4434 eldbus_message_arguments_append(reply, "is", -1, (e_info_dump_path ?: "nopath"));
4438 e_info_dump_server_or_client = 2;
4439 e_info_dump_win_id = (uint64_t)tmp;
4443 e_info_dump_running = 1;
4444 e_info_dump_mark_count = 0;
4445 e_info_dump_count = 1;
4446 e_info_dump_path = _e_info_server_dump_directory_make(path);
4448 if (e_info_dump_path == NULL)
4450 e_info_dump_running = 0;
4451 e_info_dump_count = 0;
4452 e_info_dump_win_id = 0;
4453 e_info_dump_server_or_client = 0;
4454 ERR("dump_buffers start fail\n");
4455 eldbus_message_arguments_append(reply, "is", -1, (e_info_dump_path ?: "nopath"));
4461 tbm_surface_internal_dump_with_scale_start(e_info_dump_path,
4466 tbm_surface_internal_dump_start(e_info_dump_path, e_comp->w, e_comp->h, count);
4468 if (e_info_dump_server_or_client != 2)
4470 tdm_helper_dump_start(e_info_dump_path, &e_info_dump_count);
4471 e_hwc_windows_debug_dump_start();
4474 if (e_info_dump_server_or_client != 1)
4476 E_LIST_HANDLER_APPEND(e_info_dump_hdlrs, E_EVENT_CLIENT_BUFFER_CHANGE,
4477 _e_info_server_cb_buffer_change, NULL);
4480 eldbus_message_arguments_append(reply, "is", 0, (e_info_dump_path ?: "nopath"));
4484 if (e_info_dump_running == 0)
4486 eldbus_message_arguments_append(reply, "is", 0, (e_info_dump_path ?: "nopath"));
4490 e_info_server_hook_call(E_INFO_SERVER_HOOK_BUFFER_DUMP_BEGIN);
4491 tdm_helper_dump_stop();
4492 e_hwc_windows_debug_dump_stop();
4493 tbm_surface_internal_dump_end();
4495 eldbus_message_arguments_append(reply, "is", 0, (e_info_dump_path ?: "nopath"));
4497 E_FREE_LIST(e_info_dump_hdlrs, ecore_event_handler_del);
4498 e_info_dump_hdlrs = NULL;
4499 if (e_info_dump_path)
4501 free(e_info_dump_path);
4502 e_info_dump_path = NULL;
4504 e_info_dump_count = 0;
4505 e_info_dump_running = 0;
4506 e_info_dump_mark_count = 0;
4507 e_info_dump_server_or_client = 0;
4508 e_info_dump_win_id = 0;
4509 e_info_server_hook_call(E_INFO_SERVER_HOOK_BUFFER_DUMP_END);
4515 static Eldbus_Message *
4516 _e_info_server_cb_selected_buffer_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4518 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4519 const char *win_str = NULL;
4520 const char *path = NULL;
4521 uint64_t win_id = 0;
4524 Eina_Bool res = EINA_FALSE;
4526 Dump_Win_Data *dump = NULL;
4527 E_Capture_Save_State state;
4529 if (!eldbus_message_arguments_get(msg, "ss", &win_str, &path))
4531 ERR("Error getting arguments.");
4535 if (strlen(win_str) >= 2 && win_str[0] == '0' && win_str[1] == 'x')
4536 res = e_util_string_to_ulong(win_str, &tmp, 16);
4538 res = e_util_string_to_ulong(win_str, &tmp, 10);
4540 EINA_SAFETY_ON_FALSE_GOTO(res == EINA_TRUE, end);
4542 win_id = (uint64_t)tmp;
4544 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
4546 E_Client *ec = evas_object_data_get(o, "E_Client");
4549 char fname[PATH_MAX];
4550 Eina_Stringshare *s_fname, *s_path;
4553 if (e_client_util_ignored_get(ec)) continue;
4555 win = e_client_util_win_get(ec);
4557 if (win_id != win) continue;
4559 dump = E_NEW(Dump_Win_Data, 1);
4560 EINA_SAFETY_ON_NULL_RETURN_VAL(dump, reply);
4563 dump->reply = reply;
4565 snprintf(fname, sizeof(fname), "0x%08zx", win);
4567 s_fname = eina_stringshare_add(fname);
4568 s_path = eina_stringshare_add(path);
4570 state = e_client_image_save(ec, s_path, s_fname, _image_save_done_cb, dump, EINA_TRUE);
4572 eina_stringshare_del(s_path);
4573 eina_stringshare_del(s_fname);
4575 //creation of window dump job succeeded, reply will be sent after dump ends.
4576 if (state == E_CAPTURE_SAVE_STATE_START)
4586 //send reply with error msg because dump job failed.
4587 eldbus_message_arguments_append(reply, "s", "ERR: Can't start dump job");
4592 _e_info_server_cb_screen_dump_cb(E_Output *eout, tbm_surface_h surface, void *user_data)
4594 char *path = (char *)user_data;
4595 char fname[PATH_MAX];
4597 char type[PATH_MAX];
4599 int dlen = 0, flen = 0;
4601 EINA_SAFETY_ON_NULL_GOTO(surface, done);
4602 EINA_SAFETY_ON_NULL_GOTO(path, done);
4604 slash = strrchr(path, '/');
4607 ERR("cannot find /");
4612 dlen = strnlen(path, PATH_MAX) - strnlen(slash, PATH_MAX);
4615 ERR("cannot get path");
4618 strncpy(dir, path, dlen);
4621 dot = strrchr(path, '.');
4624 ERR("cannot find .");
4628 flen = strnlen(slash, PATH_MAX) - strnlen(dot, PATH_MAX);
4631 ERR("cannot get file name");
4634 strncpy(fname, slash, flen);
4638 strncpy(type, dot, PATH_MAX);
4641 tbm_surface_internal_capture_buffer(surface, dir, fname, type);
4643 DBG("_e_info_server_cb_screen_dump_cb done");
4648 if (surface != NULL)
4649 tbm_surface_destroy(surface);
4652 static Eldbus_Message *
4653 _e_info_server_cb_screen_dump(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4655 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4656 const char *path = NULL;
4657 tbm_surface_h surface = NULL;
4658 E_Output *eout = NULL;
4660 Eina_Bool ret = EINA_FALSE;
4661 char *path_backup = NULL;
4663 if (!eldbus_message_arguments_get(msg, "s", &path))
4665 ERR("Error getting arguments.");
4669 eout = e_output_find_by_index(0);
4672 ERR("Error get main outpute.");
4675 e_output_size_get(eout, &w, &h);
4677 surface = tbm_surface_create(w, h, TBM_FORMAT_ARGB8888);
4680 ERR("Error create tbm_surface.");
4684 path_backup = (char *)calloc(1, PATH_MAX * sizeof(char));
4685 if (path_backup == NULL)
4687 ERR("Error alloc.");
4690 strncpy(path_backup, path, PATH_MAX);
4692 ret = e_output_capture(eout, surface, EINA_FALSE, EINA_TRUE, _e_info_server_cb_screen_dump_cb, path_backup);
4696 ERR("Error fail capture.");
4699 tbm_surface_destroy(surface);
4705 _output_mode_set(E_Comp_Screen *e_comp_screen, int output_idx, int mode_count)
4708 E_Output_Mode *emode = NULL;
4709 Eina_List *mode_list = NULL;
4712 EINA_SAFETY_ON_TRUE_RETURN(output_idx > e_comp_screen->num_outputs);
4714 output = eina_list_nth(e_comp_screen->outputs, output_idx);
4715 EINA_SAFETY_ON_NULL_RETURN(output);
4717 mode_list = e_output_mode_list_get(output);
4718 EINA_SAFETY_ON_NULL_RETURN(mode_list);
4720 num = eina_list_count(mode_list);
4721 EINA_SAFETY_ON_TRUE_RETURN(mode_count > num - 1);
4723 emode = eina_list_nth(mode_list, mode_count);
4724 EINA_SAFETY_ON_NULL_RETURN(emode);
4726 if (!e_output_mode_apply(output, emode))
4727 ERR("fail to e_output_mode_apply");
4731 _output_mode_msg_clients_append(Eldbus_Message_Iter *iter, E_Comp_Screen *e_comp_screen, int gl, int mode, int output_idx, int mode_count)
4733 Eldbus_Message_Iter *array_of_mode;
4734 Eldbus_Message_Iter *struct_of_mode;
4737 eldbus_message_iter_arguments_append(iter, "a("SIGNATURE_OUTPUT_MODE_SERVER")",
4742 eldbus_message_iter_arguments_append(array_of_mode, "("SIGNATURE_OUTPUT_MODE_SERVER")",
4744 eldbus_message_iter_arguments_append(struct_of_mode, SIGNATURE_OUTPUT_MODE_SERVER,
4745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "none",
4746 0, 0, 0, 0, TDM_OUTPUT_DPMS_OFF);
4747 eldbus_message_iter_container_close(array_of_mode, struct_of_mode);
4749 eldbus_message_iter_container_close(iter, array_of_mode);
4754 if (mode == E_INFO_CMD_OUTPUT_MODE_SET)
4755 _output_mode_set(e_comp_screen, output_idx, mode_count);
4757 count = e_comp_screen->num_outputs;
4759 for (i = 0; i < count; i++)
4761 E_Output *eout = e_output_find_by_index(i);
4762 E_Output_Mode *current_mode = NULL;
4763 E_Output_Mode *emode = NULL;
4764 Eina_List *modelist = NULL, *l = NULL;
4765 const tdm_output_mode *tmode = NULL;
4767 unsigned int preferred;
4770 if (eout == NULL) continue;
4772 if (e_output_connected(eout) == EINA_FALSE)
4774 eldbus_message_iter_arguments_append(array_of_mode, "("SIGNATURE_OUTPUT_MODE_SERVER")",
4776 eldbus_message_iter_arguments_append(struct_of_mode, SIGNATURE_OUTPUT_MODE_SERVER,
4777 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "none",
4778 0, i, 0, 1, TDM_OUTPUT_DPMS_OFF);
4779 eldbus_message_iter_container_close(array_of_mode, struct_of_mode);
4784 current_mode = e_output_current_mode_get(eout);
4785 modelist = e_output_mode_list_get(eout);
4786 if (modelist == NULL) continue;
4788 EINA_LIST_FOREACH(modelist, l, emode)
4790 if (emode == NULL) continue;
4792 tmode = emode->tmode;
4794 if (tmode->type & TDM_OUTPUT_MODE_TYPE_PREFERRED) preferred = 1;
4797 if (emode == current_mode) current = 1;
4800 dpms = e_output_dpms_get(eout);
4802 eldbus_message_iter_arguments_append(array_of_mode, "("SIGNATURE_OUTPUT_MODE_SERVER")",
4804 eldbus_message_iter_arguments_append(struct_of_mode, SIGNATURE_OUTPUT_MODE_SERVER,
4805 tmode->hdisplay, tmode->hsync_start, tmode->hsync_end, tmode->htotal,
4806 tmode->vdisplay, tmode->vsync_start, tmode->vsync_end, tmode->vtotal,
4807 tmode->vrefresh, tmode->vscan, tmode->clock, preferred, tmode->name,
4808 current, i, 1, 1, dpms);
4809 eldbus_message_iter_container_close(array_of_mode, struct_of_mode);
4813 eldbus_message_iter_container_close(iter, array_of_mode);
4816 static Eldbus_Message *
4817 _e_info_server_cb_output_mode(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4819 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4820 E_Comp_Screen *e_comp_screen = NULL;
4821 tdm_display *tdpy = NULL;
4822 int mode = 0, count = 0, output_idx = 0;
4824 if (!eldbus_message_arguments_get(msg, SIGNATURE_OUTPUT_MODE_CLIENT, &mode, &output_idx, &count))
4826 ERR("Error getting arguments.");
4830 if ((mode == E_INFO_CMD_OUTPUT_MODE_GET) ||
4831 (mode == E_INFO_CMD_OUTPUT_MODE_SET))
4833 e_comp_screen = e_comp->e_comp_screen;
4834 tdpy = e_comp_screen->tdisplay;
4837 _output_mode_msg_clients_append(eldbus_message_iter_get(reply), e_comp_screen, 1, mode, output_idx, count);
4839 _output_mode_msg_clients_append(eldbus_message_iter_get(reply), e_comp_screen, 0, 0, 0, 0);
4845 static Eldbus_Message *
4846 e_info_server_cb_hwc_trace_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4848 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4851 if (!eldbus_message_arguments_get(msg, "i", &onoff))
4853 ERR("Error getting arguments.");
4857 if (onoff == 0 || onoff == 1)
4859 e_plane_hwc_trace_debug(onoff);
4860 e_hwc_windows_trace_debug(onoff);
4864 e_comp_screen_hwc_info_debug();
4869 static Eldbus_Message *
4870 e_info_server_cb_damage_trace_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4872 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4875 if (!eldbus_message_arguments_get(msg, "i", &on))
4877 ERR("Error getting arguments.");
4881 if (on == 0 || on == 1)
4882 e_comp_object_damage_trace_debug(on);
4887 static Eldbus_Message *
4888 e_info_server_cb_prstt_trace_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4890 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4893 if (!eldbus_message_arguments_get(msg, "i", &on))
4895 ERR("Error getting arguments.");
4899 if (on == 0 || on == 1)
4900 e_presentation_time_trace_debug(on);
4905 static Eldbus_Message *
4906 e_info_server_cb_hwc(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4908 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4913 if (!eldbus_message_arguments_get(msg, "i", &info))
4915 ERR("Error getting arguments.");
4921 ERR("Error HWC is not initialized.");
4925 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, reply);
4926 EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp->e_comp_screen, reply);
4931 EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output)
4932 e_hwc_deactive_set(output->hwc, EINA_TRUE);
4936 EINA_LIST_FOREACH(e_comp->e_comp_screen->outputs, l, output)
4937 e_hwc_deactive_set(output->hwc, EINA_FALSE);
4942 e_comp_screen_hwc_info_debug();
4949 static Eldbus_Message *
4950 e_info_server_cb_exsync_trace_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4952 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4955 if (!eldbus_message_arguments_get(msg, "i", &on))
4957 ERR("Error getting arguments.");
4961 if (on == 0 || on == 1)
4962 e_explicit_sync_trace_debug(on);
4967 static Eldbus_Message *
4968 e_info_server_cb_show_plane_state(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
4970 Eina_List *output_l, *plane_l;
4971 E_Comp_Screen *e_comp_screen = NULL;
4972 E_Output *output = NULL;
4973 E_Plane *plane = NULL;
4974 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
4976 e_comp_screen = e_comp->e_comp_screen;
4978 EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output)
4980 if (!output) continue;
4982 EINA_LIST_FOREACH(output->planes, plane_l, plane)
4984 if (!plane) continue;
4986 e_plane_show_state(plane);
4994 _msg_show_pending_commit_append(Eldbus_Message_Iter *iter)
4996 Eina_List *output_l, *plane_l, *data_l;
4997 Eldbus_Message_Iter *array_of_pending_commit;
4998 E_Comp_Screen *e_comp_screen = NULL;
4999 E_Output *output = NULL;
5000 E_Plane *plane = NULL;
5001 E_Plane_Commit_Data *data = NULL;
5003 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_PENDING_COMMIT")", &array_of_pending_commit);
5005 e_comp_screen = e_comp->e_comp_screen;
5007 EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output)
5009 if (!output) continue;
5011 EINA_LIST_FOREACH(output->planes, plane_l, plane)
5013 if (!plane) continue;
5015 EINA_LIST_FOREACH(plane->commit_data_list, data_l, data)
5017 Eldbus_Message_Iter* struct_of_pending_commit;
5019 if (!data) continue;
5021 eldbus_message_iter_arguments_append(array_of_pending_commit, "("VALUE_TYPE_FOR_PENDING_COMMIT")", &struct_of_pending_commit);
5023 eldbus_message_iter_arguments_append
5024 (struct_of_pending_commit, VALUE_TYPE_FOR_PENDING_COMMIT,
5028 (uintptr_t)data->tsurface);
5030 eldbus_message_iter_container_close(array_of_pending_commit, struct_of_pending_commit);
5035 eldbus_message_iter_container_close(iter, array_of_pending_commit);
5038 static Eldbus_Message *
5039 e_info_server_cb_show_pending_commit(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5041 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5043 _msg_show_pending_commit_append(eldbus_message_iter_get(reply));
5049 _e_info_server_find_client_by_win_id(uint64_t win_id)
5055 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5057 ec = evas_object_data_get(o, "E_Client");
5060 win = e_client_util_win_get(ec);
5069 _msg_client_fps_append(Eldbus_Message_Iter *iter, E_Client *ec)
5071 Eldbus_Message_Iter *array_of_fps, *struct_of_fps;
5074 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_FPS")", &array_of_fps);
5076 if (e_client_fps_get(ec, &fps))
5078 eldbus_message_iter_arguments_append(array_of_fps, "("VALUE_TYPE_FOR_FPS")", &struct_of_fps);
5079 eldbus_message_iter_arguments_append(struct_of_fps,
5081 E_INFO_FPS_TYPE_CLIENT_WIN,
5084 e_client_util_win_get(ec),
5086 eldbus_message_iter_container_close(array_of_fps, struct_of_fps);
5089 eldbus_message_iter_container_close(iter, array_of_fps);
5093 _msg_output_fps_append(Eldbus_Message_Iter *iter)
5095 Eina_List *output_l, *plane_l, *hwc_l;
5096 Eldbus_Message_Iter *array_of_fps;
5097 E_Comp_Screen *e_comp_screen = NULL;
5098 E_Hwc_Window *hwc_window = NULL;
5099 E_Output *output = NULL;
5100 E_Plane *plane = NULL;
5102 char output_name[30];
5104 eldbus_message_iter_arguments_append(iter, "a("VALUE_TYPE_FOR_FPS")", &array_of_fps);
5106 e_comp_screen = e_comp->e_comp_screen;
5108 EINA_LIST_FOREACH(e_comp_screen->outputs, output_l, output)
5110 if (!output) continue;
5112 strncpy(output_name, output->id, sizeof(char)*29);
5116 if (e_hwc_policy_get(output->hwc) == E_HWC_POLICY_WINDOWS)
5118 if (e_hwc_windows_fps_get(output->hwc, &fps))
5120 Eldbus_Message_Iter* struct_of_fps;
5122 eldbus_message_iter_arguments_append(array_of_fps, "("VALUE_TYPE_FOR_FPS")", &struct_of_fps);
5124 eldbus_message_iter_arguments_append
5125 (struct_of_fps, VALUE_TYPE_FOR_FPS,
5126 E_INFO_FPS_TYPE_OUTPUT,
5132 eldbus_message_iter_container_close(array_of_fps, struct_of_fps);
5135 EINA_LIST_FOREACH(output->hwc->hwc_windows, hwc_l, hwc_window)
5137 E_Hwc_Window_State state;
5138 Eldbus_Message_Iter* struct_of_fps;
5140 if(!hwc_window) continue;
5142 state = e_hwc_window_accepted_state_get(hwc_window);
5143 if ((state == E_HWC_WINDOW_STATE_CLIENT) || (state == E_HWC_WINDOW_STATE_NONE)) continue;
5144 if (!e_hwc_window_fps_get(hwc_window, &fps)) continue;
5146 eldbus_message_iter_arguments_append(array_of_fps, "("VALUE_TYPE_FOR_FPS")", &struct_of_fps);
5148 eldbus_message_iter_arguments_append
5149 (struct_of_fps, VALUE_TYPE_FOR_FPS,
5150 hwc_window->is_target ? E_INFO_FPS_TYPE_HWC_COMP : E_INFO_FPS_TYPE_HWC_WIN,
5153 hwc_window->is_target ? 0 : e_client_util_win_get(hwc_window->ec),
5156 eldbus_message_iter_container_close(array_of_fps, struct_of_fps);
5161 EINA_LIST_FOREACH(output->planes, plane_l, plane)
5163 if (!plane) continue;
5164 if (!e_plane_fps_get(plane, &fps)) continue;
5166 Eldbus_Message_Iter* struct_of_fps;
5168 eldbus_message_iter_arguments_append(array_of_fps, "("VALUE_TYPE_FOR_FPS")", &struct_of_fps);
5170 eldbus_message_iter_arguments_append
5171 (struct_of_fps, VALUE_TYPE_FOR_FPS,
5172 E_INFO_FPS_TYPE_LAYER,
5178 eldbus_message_iter_container_close(array_of_fps, struct_of_fps);
5185 memset(output_name, 0x0, sizeof(char)*30);
5188 eldbus_message_iter_container_close(iter, array_of_fps);
5191 static Eldbus_Message *
5192 _e_info_server_cb_fps_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5194 const char *win_str;
5195 uint64_t win_id = 0;
5198 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5200 if (!eldbus_message_arguments_get(msg, "s", &win_str))
5202 ERR("Error getting arguments");
5206 if (e_util_strcmp(win_str, "none"))
5208 if (!e_util_string_to_ulong(win_str, &tmp, 16))
5211 win_id = (uint64_t)tmp;
5213 ec = _e_info_server_find_client_by_win_id(win_id);
5214 if (!ec) return reply;
5216 e_client_fps_enable(ec, EINA_TRUE);
5217 _msg_client_fps_append(eldbus_message_iter_get(reply), ec);
5221 e_comp->calc_fps = 1;
5222 _msg_output_fps_append(eldbus_message_iter_get(reply));
5228 static Eldbus_Message *
5229 e_info_server_cb_effect_control(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5231 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5235 if (!eldbus_message_arguments_get(msg, "i", &onoff))
5237 ERR("Error getting arguments.");
5241 m = e_module_find("e-mod-tizen-effect");
5246 m = e_module_new("e-mod-tizen-effect");
5250 else if (onoff == 0)
5254 e_module_disable(m);
5255 e_object_del(E_OBJECT(m));
5262 static Eldbus_Message *
5263 e_info_server_cb_quickpanel_control(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5265 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5266 const char *win_str;
5268 unsigned long tmp = 0;
5269 uint64_t win_id = 0;
5270 E_Client *ec = NULL;
5272 Eina_Bool res = EINA_FALSE;
5274 if (!eldbus_message_arguments_get(msg, "is", &operation, &win_str))
5276 ERR("Error getting arguments.");
5280 if (!e_util_strcmp("default", win_str))
5284 res = e_util_string_to_ulong(win_str, &tmp, 16);
5285 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
5287 win_id = (uint64_t)tmp;
5289 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5291 ec = evas_object_data_get(o, "E_Client");
5294 Ecore_Window win = e_client_util_win_get(ec);
5301 if ((operation >= 0) && (operation <= 3))
5302 e_qp_control_by_command(ec, operation);
5307 static Eldbus_Message *
5308 e_info_server_cb_magnifier(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5310 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5313 if (!eldbus_message_arguments_get(msg, "i", &opcode))
5315 ERR("Error getting arguments.");
5321 case 0: // magnifier off test
5322 e_magnifier_stand_alone_mode_set(EINA_FALSE);
5323 e_magnifier_hide(NULL);
5327 case 1: // magnifier on test
5329 e_magnifier_stand_alone_mode_set(EINA_TRUE);
5330 e_magnifier_show(NULL);
5333 case 2: // magnifier new
5337 case 3: // magnifier del
5341 case 4: // set stand_alone
5342 e_magnifier_stand_alone_mode_set(EINA_TRUE);
5345 case 5: // unset stand_alone
5346 e_magnifier_stand_alone_mode_set(EINA_FALSE);
5349 case 6: // magnifier show
5350 e_magnifier_show(NULL);
5353 case 7: // magnifier hide
5354 e_magnifier_hide(NULL);
5364 static Eldbus_Message *
5365 e_info_server_cb_aux_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5367 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5368 Eldbus_Message_Iter *opt_iter;
5369 const char *win_str, *key, *val, *opt;
5370 Eina_List *options = NULL;
5371 unsigned long tmp = 0;
5372 uint64_t win_id = 0;
5375 Eina_Bool res = EINA_FALSE;
5379 ERR("e_policy is not initialized!");
5383 if (!eldbus_message_arguments_get(msg, "sssa(s)", &win_str, &key, &val, &opt_iter))
5385 ERR("Error getting arguments.");
5389 while (eldbus_message_iter_get_and_next(opt_iter, 's', &opt))
5393 str = eina_stringshare_add(opt);
5394 options = eina_list_append(options, str);
5397 res = e_util_string_to_ulong(win_str, &tmp, 16);
5398 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
5400 win_id = (uint64_t)tmp;
5402 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5404 ec = evas_object_data_get(o, "E_Client");
5407 Ecore_Window win = e_client_util_win_get(ec);
5411 e_policy_aux_message_send(ec, key, val, options);
5416 EINA_LIST_FREE(options, opt)
5417 eina_stringshare_del(opt);
5422 static Eldbus_Message *
5423 e_info_server_cb_aux_hint_add(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5425 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5426 const char *win_str, *hint, *val;
5428 unsigned long tmp = 0;
5429 uint64_t win_id = 0;
5432 Eina_Bool res = EINA_FALSE;
5436 ERR("e_policy is not initialized!");
5440 if (!eldbus_message_arguments_get(msg, "suss", &win_str, &hint_id, &hint, &val))
5442 ERR("Error getting arguments.");
5446 res = e_util_string_to_ulong(win_str, &tmp, 16);
5447 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
5449 win_id = (uint64_t)tmp;
5451 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5453 ec = evas_object_data_get(o, "E_Client");
5456 if (e_client_util_win_get(ec) == win_id)
5458 res = e_hints_aux_hint_add(ec, hint_id, hint, val);
5459 if (res) e_policy_wl_aux_hint_apply(ec);
5467 static Eldbus_Message *
5468 e_info_server_cb_aux_hint_del(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5470 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5471 const char *win_str;
5473 unsigned long tmp = 0;
5474 uint64_t win_id = 0;
5477 Eina_Bool res = EINA_FALSE;
5481 ERR("e_policy is not initialized!");
5485 if (!eldbus_message_arguments_get(msg, "su", &win_str, &hint_id))
5487 ERR("Error getting arguments.");
5491 res = e_util_string_to_ulong(win_str, &tmp, 16);
5492 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
5494 win_id = (uint64_t)tmp;
5496 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5498 ec = evas_object_data_get(o, "E_Client");
5501 if (e_client_util_win_get(ec) == win_id)
5503 res = e_hints_aux_hint_del(ec, hint_id);
5504 if (res) e_policy_wl_aux_hint_apply(ec);
5512 static Eldbus_Message *
5513 _e_info_server_cb_force_render(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5515 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5516 E_Info_Cmd_Force_Render cmd;
5519 E_Client *ec = NULL;
5521 res = eldbus_message_arguments_get(msg,
5524 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
5528 case E_INFO_CMD_FRENDER_ALL:
5529 E_CLIENT_FOREACH(ec)
5531 if (ec->visible && (!ec->input_only))
5532 e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
5534 evas_damage_rectangle_add(e_comp->evas, 0, 0, e_comp->w, e_comp->h);
5535 e_comp_render_queue();
5536 snprintf(result, sizeof(result),
5537 "[Server] force rendered all clients and canvas\n");
5539 case E_INFO_CMD_FRENDER_CLS:
5540 E_CLIENT_FOREACH(ec)
5542 if (ec->visible && (!ec->input_only))
5543 e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
5545 e_comp_render_queue();
5546 snprintf(result, sizeof(result),
5547 "[Server] updated clients' surface");
5549 case E_INFO_CMD_FRENDER_CANVAS:
5550 evas_damage_rectangle_add(e_comp->evas, 0, 0, e_comp->w, e_comp->h);
5551 snprintf(result, sizeof(result),
5552 "[Server] updated canvas");
5555 snprintf(result, sizeof(result),
5556 "[Server] Error Unknown cmd(%d) for the render force",
5561 eldbus_message_arguments_append(reply,
5568 static Eldbus_Message *
5569 _e_info_server_cb_screen_rotation_pre(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5571 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5574 if (!eldbus_message_arguments_get(msg, "i", &rotation_pre))
5576 ERR("Error getting arguments.");
5580 if (!e_comp || !e_comp->e_comp_screen)
5582 ERR("Error no screen.");
5586 e_comp_screen_rotation_pre_set(e_comp->e_comp_screen, rotation_pre);
5588 if (e_config->screen_rotation_pre != rotation_pre)
5590 if (!e_config_save_block_get())
5592 e_config->screen_rotation_pre = rotation_pre;
5593 e_config_save_queue();
5594 INF("Saving screen_rotation_pre (%d) to e.cfg has been scheduled.", rotation_pre);
5598 INF("Since saving to e.cfg is set to block, it's not possible to save screen_rotation_pre (%d).", rotation_pre);
5605 static Eldbus_Message *
5606 _e_info_server_cb_screen_rotation(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5608 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5611 if (!eldbus_message_arguments_get(msg, "i", &rotation))
5613 ERR("Error getting arguments.");
5617 if (!e_comp || !e_comp->e_comp_screen)
5619 ERR("Error no screen.");
5623 e_comp_screen_rotation_setting_set(e_comp->e_comp_screen, rotation);
5628 static Eldbus_Message *
5629 _e_info_server_cb_remote_surface(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5631 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5632 int dump_request, info_query;
5634 Eldbus_Message_Iter *iter, *line_array;
5636 res = eldbus_message_arguments_get(msg,
5637 "ii", &dump_request, &info_query);
5638 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
5642 e_comp_wl_remote_surface_debug_info_get(eldbus_message_iter_get(reply));
5644 else if (dump_request != -1)
5646 char reply_msg[1024] = "";
5648 e_info_dump_remote_surface = dump_request;
5650 snprintf(reply_msg, sizeof(reply_msg), "Switch %s remote surface dump",
5651 dump_request? "ON":"OFF");
5653 iter = eldbus_message_iter_get(reply);
5654 eldbus_message_iter_arguments_append(iter, "as", &line_array);
5655 eldbus_message_iter_basic_append(line_array, 's', reply_msg);
5656 eldbus_message_iter_container_close(iter, line_array);
5663 _e_info_server_top_win_at_xy_get(int x, int y)
5668 o = evas_object_top_at_xy_get(e_comp->evas, x, y, EINA_FALSE, EINA_FALSE);
5669 EINA_SAFETY_ON_NULL_RETURN_VAL(o, 0);
5671 ec = evas_object_data_get(o, "E_Client");
5672 EINA_SAFETY_ON_NULL_RETURN_VAL(ec, 0);
5674 return e_client_util_win_get(ec);
5678 _e_info_server_cb_ecore_event_filter(void *data, void *loop_data EINA_UNUSED, int type, void *event)
5680 Ecore_Event_Mouse_Button *e;
5682 Ecore_Event_Filter **event_filter;
5684 if (type != ECORE_EVENT_MOUSE_BUTTON_DOWN && type != ECORE_EVENT_MOUSE_BUTTON_UP
5685 && type != ECORE_EVENT_MOUSE_MOVE && type != ECORE_EVENT_MOUSE_WHEEL
5686 && type != ECORE_EVENT_MOUSE_IN && type != ECORE_EVENT_MOUSE_OUT)
5689 if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN)
5692 event_filter = data;
5694 win = _e_info_server_top_win_at_xy_get(e->x, e->y);
5695 EINA_SAFETY_ON_FALSE_RETURN_VAL(win, EINA_FALSE);
5697 ecore_event_filter_del(*event_filter);
5700 eldbus_service_signal_emit(e_info_server.iface, E_INFO_SERVER_SIGNAL_WIN_UNDER_TOUCH, (uint64_t)win);
5706 static Eldbus_Message *
5707 _e_info_server_cb_get_win_under_touch(const Eldbus_Service_Interface *iface EINA_UNUSED,
5708 const Eldbus_Message *msg)
5711 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5712 Ecore_Event_Filter **event_filter;;
5714 event_filter = calloc(1, sizeof(Ecore_Event_Filter *));
5715 EINA_SAFETY_ON_NULL_GOTO(event_filter, fail);
5717 *event_filter = ecore_event_filter_add(NULL, _e_info_server_cb_ecore_event_filter,
5718 NULL, event_filter);
5719 EINA_SAFETY_ON_NULL_GOTO(*event_filter, fail);
5729 eldbus_message_arguments_append(reply, "i", result);
5735 _e_info_server_ec_find_by_win(Ecore_Window win)
5740 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5744 ec = evas_object_data_get(o, "E_Client");
5747 w = e_client_util_win_get(ec);
5755 const static int KILL_ID_MODE = 1;
5756 const static int KILL_NAME_MODE = 2;
5757 const static int KILL_PID_MODE = 3;
5758 const static int KILL_PID_FORCE_MODE = 5;
5761 _e_info_server_pid_kill(pid_t id, Eldbus_Message_Iter *array_of_string)
5767 E_Comp_Wl_Data *wl_cdata;
5768 struct wl_list * client_list;
5769 struct wl_client *client;
5771 if (!e_comp) return 0;
5772 if (!(wl_cdata = e_comp->wl_comp_data)) return 0;
5773 if (!wl_cdata->wl.disp) return 0;
5775 client_list = wl_display_get_client_list(wl_cdata->wl.disp);
5777 wl_client_for_each(client, client_list)
5780 wl_client_get_credentials(client, &pid, NULL, NULL);
5781 if (pid != id) continue;
5783 INF("[%s] client(%p, pid:%d) has been destroyed !", __FUNCTION__, client, pid);
5784 wl_client_destroy(client);
5786 snprintf(result, sizeof(result), "[Server] A client (PID:%d) has been destroyed !", pid);
5787 eldbus_message_iter_arguments_append(array_of_string, VALUE_TYPE_REPLY_KILL, result);
5796 _e_info_server_ec_kill(uint32_t mode, void *value, Eldbus_Message_Iter *array_of_string)
5803 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5805 const char *ec_name, *find;
5807 ec = evas_object_data_get(o, "E_Client");
5809 if (e_client_util_ignored_get(ec)) continue;
5811 ec_name = e_client_util_name_get(ec) ?: "NO NAME";
5813 if (mode == KILL_NAME_MODE)
5815 find = strstr(ec_name, (const char *)value);
5820 else if (mode == KILL_PID_MODE)
5823 pid = ec->netwm.pid;
5828 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
5830 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
5833 if (pid != *(pid_t *)value)
5838 e_client_act_kill_begin(ec);
5840 snprintf(result, sizeof(result), "[Server] killing creator(%s) of resource 0x%zx",
5841 ec_name, e_client_util_win_get(ec));
5842 eldbus_message_iter_arguments_append(array_of_string, VALUE_TYPE_REPLY_KILL, result);
5848 static Eldbus_Message *
5849 _e_info_server_cb_kill_client(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5851 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
5852 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
5856 uint64_t uint64_value;
5858 const char *str_value;
5860 Eldbus_Message_Iter *array_of_string = NULL;
5862 res = eldbus_message_arguments_get(msg, VALUE_TYPE_REQUEST_FOR_KILL,
5863 &mode, &uint64_value, &str_value);
5864 if (res != EINA_TRUE)
5866 snprintf(result, sizeof(result),
5867 "[Server] Error: cannot get the arguments from an Eldbus_Message");
5871 eldbus_message_iter_arguments_append(iter, "a"VALUE_TYPE_REPLY_KILL, &array_of_string);
5873 if (mode == KILL_ID_MODE)
5875 Ecore_Window win = uint64_value;
5877 ec = _e_info_server_ec_find_by_win(win);
5880 snprintf(result, sizeof(result),
5881 "[Server] Error: cannot find the E_Client.");
5885 e_client_act_kill_begin(ec);
5887 snprintf(result, sizeof(result),
5888 "[Server] killing creator(%s) of resource 0x%zx",
5889 e_client_util_name_get(ec) ?: "NO NAME", win);
5891 else if (mode >= KILL_NAME_MODE && mode <= KILL_PID_FORCE_MODE)
5893 if (mode == KILL_NAME_MODE)
5894 count = _e_info_server_ec_kill(mode, (void *)str_value, array_of_string);
5895 else if (mode == KILL_PID_FORCE_MODE)
5896 count = _e_info_server_pid_kill((pid_t)uint64_value, array_of_string);
5898 count = _e_info_server_ec_kill(mode, (void *)&uint64_value, array_of_string);
5900 snprintf(result, sizeof(result), "\n[Server] killed %d client(s)", count);
5904 snprintf(result, sizeof(result), "[Server] Error: wrong mode.");
5908 eldbus_message_iter_arguments_append(array_of_string, VALUE_TYPE_REPLY_KILL, result);
5909 eldbus_message_iter_container_close(iter, array_of_string);
5914 static Eldbus_Message *
5915 _e_info_server_cb_get_windows(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
5917 const static int _E_GET_WINDOWS_NAME_MODE = 1;
5918 const static int _E_GET_WINDOWS_PID_MODE = 2;
5919 Eldbus_Message *reply;
5920 Eldbus_Message_Iter *iter;
5926 Eldbus_Message_Iter *array_of_windows;
5930 res = eldbus_message_arguments_get(msg, "is", &mode, &value);
5931 if (res != EINA_TRUE)
5933 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
5934 "get_windows: an attempt to get arguments from method call message failed");
5937 if (mode == _E_GET_WINDOWS_PID_MODE)
5939 if (strlen(value) >= 2 && value[0] == '0' && value[1] == 'x')
5940 res = e_util_string_to_int(value, &pid, 16);
5942 res = e_util_string_to_int(value, &pid, 10);
5944 if (res == EINA_FALSE)
5945 return eldbus_message_error_new(msg, INVALID_ARGS,
5946 "get_windows: invalid input arguments");
5949 reply = eldbus_message_method_return_new(msg);
5950 iter = eldbus_message_iter_get(reply);
5952 eldbus_message_iter_arguments_append(iter, "at", &array_of_windows);
5954 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
5956 const char *ec_name, *find;
5959 ec = evas_object_data_get(o, "E_Client");
5962 ec_name = e_client_util_name_get(ec) ?: "NO NAME";
5964 if (mode == _E_GET_WINDOWS_NAME_MODE)
5966 find = strstr(ec_name, (const char *)value);
5971 else if (mode == _E_GET_WINDOWS_PID_MODE)
5975 ec_pid = ec->netwm.pid;
5980 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
5982 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &ec_pid, NULL, NULL);
5989 win = e_client_util_win_get(ec);
5993 eldbus_message_iter_arguments_append(array_of_windows, "t", win);
5996 eldbus_message_iter_container_close(iter, array_of_windows);
6001 eldbus_message_unref(reply);
6003 return eldbus_message_error_new(msg, WIN_NOT_EXIST,
6004 "get_windows: specified window(s) doesn't exist");
6007 static Eldbus_Message *
6008 _e_info_server_cb_get_window_name(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6010 Eldbus_Message *reply;
6015 res = eldbus_message_arguments_get(msg, VALUE_TYPE_REQUEST_FOR_WININFO,
6017 if (res != EINA_TRUE)
6019 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6020 "get_window_name: an attempt to get arguments from method call message failed");
6023 ec = _e_info_server_ec_find_by_win(win);
6026 return eldbus_message_error_new(msg, WIN_NOT_EXIST, "get_window_name: specified window doesn't exist");
6029 reply = eldbus_message_method_return_new(msg);
6031 eldbus_message_arguments_append(reply, "s",
6032 e_client_util_name_get(ec) ?: "NO NAME");
6038 _e_info_server_wininfo_tree_info_add(E_Client *ec, Eldbus_Message_Iter *iter,
6039 int recurse, int level)
6041 Eldbus_Message_Iter *struct_of_child;
6048 EINA_LIST_FOREACH(ec->transients, l, child)
6052 int hwc = -1, hwc_policy = E_HWC_POLICY_NONE, pl_zpos = -999;
6055 num_child = eina_list_count(child->transients);
6057 if ((!child->iconic) && (!e_client_visibility_get(child)) &&
6058 evas_object_visible_get(ec->frame))
6059 _e_info_server_ec_hwc_info_get(child, &hwc, &hwc_policy, &pl_zpos);
6061 win = e_client_util_win_get(child);
6062 eldbus_message_iter_arguments_append(iter, "(tsiiiiiiii)", &struct_of_child);
6063 eldbus_message_iter_arguments_append
6064 (struct_of_child, "tsiiiiiiii", win, e_client_util_name_get(child) ?: "NO NAME",
6065 num_child, level, child->x, child->y, child->w, child->h, hwc, pl_zpos);
6066 eldbus_message_iter_container_close(iter, struct_of_child);
6069 _e_info_server_wininfo_tree_info_add(child, iter, 1, level + 1);
6074 static Eldbus_Message *
6075 _e_info_server_cb_wininfo_tree(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6077 Eldbus_Message *reply;
6078 Eldbus_Message_Iter *iter, *array_of_child;
6084 res = eldbus_message_arguments_get(msg, VALUE_TYPE_REQUEST_FOR_WININFO_TREE,
6086 if (res != EINA_TRUE)
6088 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6089 "wininfo: an attempt to get arguments from method call message failed");
6092 ec = _e_info_server_ec_find_by_win(win);
6095 return eldbus_message_error_new(msg, WIN_NOT_EXIST, "wininfo: specified window(s) doesn't exist");
6098 reply = eldbus_message_method_return_new(msg);
6099 iter = eldbus_message_iter_get(reply);
6101 eldbus_message_iter_basic_append(iter, 't', (uint64_t)e_client_util_win_get(ec->parent));
6102 eldbus_message_iter_basic_append(iter, 's', e_client_util_name_get(ec->parent) ?: "NO NAME");
6103 eldbus_message_iter_basic_append(iter, 'i', eina_list_count(ec->transients));
6105 array_of_child = eldbus_message_iter_container_new(iter, 'a', "(tsiiiiiiii)");
6106 _e_info_server_wininfo_tree_info_add(ec, array_of_child, recurse, 1);
6107 eldbus_message_iter_container_close(iter, array_of_child);
6112 static Eldbus_Message *
6113 _e_info_server_cb_wininfo(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6115 Eldbus_Message *reply;
6120 uint32_t res_id = 0;
6122 char layer_name[64];
6123 int hwc = -1, hwc_policy = E_HWC_POLICY_NONE, pl_zpos = -999;
6124 int dw, dh, xright, ybelow;;
6126 res = eldbus_message_arguments_get(msg, VALUE_TYPE_REQUEST_FOR_WININFO,
6128 if (res != EINA_TRUE)
6130 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6131 "wininfo: an attempt to get arguments from method call message failed");
6134 ec = _e_info_server_ec_find_by_win(win);
6137 return eldbus_message_error_new(msg, WIN_NOT_EXIST, "wininfo: specified window(s) doesn't exist");
6140 e_comp_layer_name_get(ec->layer, layer_name, sizeof(layer_name));
6142 pwin = e_client_util_win_get(ec->parent);
6145 res_id = e_pixmap_res_id_get(ec->pixmap);
6147 pid = ec->netwm.pid;
6152 E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
6154 wl_client_get_credentials(wl_resource_get_client(cdata->surface), &pid, NULL, NULL);
6158 _e_info_server_ec_hwc_info_get(ec, &hwc, &hwc_policy, &pl_zpos);
6160 ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &dw, &dh);
6162 xright = dw - ec->x - ec->border_size * 2 - ec->w;
6163 ybelow = dh - ec->y - ec->border_size * 2 - ec->h;
6165 reply = eldbus_message_method_return_new(msg);
6167 eldbus_message_arguments_append(reply, VALUE_TYPE_REPLY_WININFO, res_id, pid,
6168 ec->x, ec->y, ec->w, ec->h, ec->layer, ec->visible,
6169 ec->argb, ec->visibility.opaque, e_client_visibility_get(ec),
6170 ec->iconic, evas_object_visible_get(ec->frame),
6171 ec->focused, hwc, pl_zpos, (uint64_t)pwin,
6172 layer_name, xright, ybelow, ec->border_size,
6179 _e_info_server_cb_wininfo_size_hints_append(E_Client *ec, Eldbus_Message_Iter *array_of_hints)
6181 char temp[512] = {0};
6182 Evas_Coord w, h, l, r, t, b;
6185 evas_object_size_hint_min_get(ec->frame, &w, &h);
6186 snprintf(temp, sizeof(temp), " min: h(%d), v(%d)", w, h);
6187 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6189 evas_object_size_hint_max_get(ec->frame, &w, &h);
6190 snprintf(temp, sizeof(temp), " max: h(%d), v(%d)", w, h);
6191 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6193 evas_object_size_hint_request_get(ec->frame, &w, &h);
6194 snprintf(temp, sizeof(temp), " request: h(%d), v(%d)", w, h);
6195 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6197 evas_object_size_hint_align_get(ec->frame, &x, &y);
6198 snprintf(temp, sizeof(temp), " align: x(%f), y(%f)", x, y);
6199 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6201 evas_object_size_hint_weight_get(ec->frame, &x, &y);
6202 snprintf(temp, sizeof(temp), " weight: x(%f), y(%f)", x, y);
6203 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6205 evas_object_size_hint_padding_get(ec->frame, &l, &r, &t, &b);
6206 snprintf(temp, sizeof(temp), " padding: l(%d), r(%d), t(%d), b(%d)",
6208 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6212 _e_info_server_cb_wininfo_wm_hints_append(E_Client *ec, Eldbus_Message_Iter *array_of_hints)
6215 E_Comp_Wl_Aux_Hint *hint;
6216 char temp[512] = {0};
6221 EINA_LIST_FOREACH(ec->comp_data->aux_hint.hints, l, hint)
6223 snprintf(temp, sizeof(temp), "%s: %s", hint->hint, hint->val);
6224 eldbus_message_iter_arguments_append(array_of_hints, "s", temp);
6228 static Eldbus_Message *
6229 _e_info_server_cb_wininfo_hints(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6231 Eldbus_Message *reply;
6232 Eldbus_Message_Iter *iter, *array_of_hints;
6238 res = eldbus_message_arguments_get(msg, "it", &wm_mode, &win);
6239 if (res != EINA_TRUE)
6241 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6242 "wininfo_hints: an attempt to get arguments from method call message failed");
6245 ec = _e_info_server_ec_find_by_win(win);
6248 return eldbus_message_error_new(msg, WIN_NOT_EXIST,
6249 "wininfo_hints: specified window(s) doesn't exist");
6252 reply = eldbus_message_method_return_new(msg);
6253 iter = eldbus_message_iter_get(reply);
6255 eldbus_message_iter_arguments_append(iter, "as", &array_of_hints);
6257 _e_info_server_cb_wininfo_wm_hints_append(ec, array_of_hints);
6259 _e_info_server_cb_wininfo_size_hints_append(ec, array_of_hints);
6260 eldbus_message_iter_container_close(iter, array_of_hints);
6265 static Eldbus_Message *
6266 _e_info_server_cb_wininfo_shape(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6268 Eldbus_Message *reply;
6269 Eldbus_Message_Iter *iter, *array_of_shape, *struct_of_shape;
6275 res = eldbus_message_arguments_get(msg, "t", &win);
6276 if (res != EINA_TRUE)
6278 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6279 "wininfo_shape: an attempt to get arguments from method call message failed");
6282 ec = _e_info_server_ec_find_by_win(win);
6285 return eldbus_message_error_new(msg, WIN_NOT_EXIST, "wininfo_shape: specified window(s) doesn't exist");
6288 reply = eldbus_message_method_return_new(msg);
6289 iter = eldbus_message_iter_get(reply);
6291 eldbus_message_iter_basic_append(iter, 'i', ec->shape_rects_num);
6292 array_of_shape = eldbus_message_iter_container_new(iter, 'a', "(iiii)");
6293 for(i = 0; i < ec->shape_rects_num; ++i)
6295 eldbus_message_iter_arguments_append(iter, "(iiii)", &struct_of_shape);
6296 eldbus_message_iter_arguments_append
6297 (struct_of_shape, "iiii",
6298 ec->shape_rects[i].x, ec->shape_rects[i].y,
6299 ec->shape_rects[i].w, ec->shape_rects[i].h);
6300 eldbus_message_iter_container_close(iter, struct_of_shape);
6302 eldbus_message_iter_container_close(iter, array_of_shape);
6304 eldbus_message_iter_basic_append(iter, 'i', ec->shape_input_rects_num);
6305 array_of_shape = eldbus_message_iter_container_new(iter, 'a', "(iiii)");
6306 for(i = 0; i < ec->shape_input_rects_num; ++i)
6308 eldbus_message_iter_arguments_append(iter, "(iiii)", &struct_of_shape);
6309 eldbus_message_iter_arguments_append
6310 (struct_of_shape, "iiii",
6311 ec->shape_input_rects[i].x, ec->shape_input_rects[i].y,
6312 ec->shape_input_rects[i].w, ec->shape_input_rects[i].h);
6313 eldbus_message_iter_container_close(iter, struct_of_shape);
6315 eldbus_message_iter_container_close(iter, array_of_shape);
6320 static Eldbus_Message *
6321 _e_info_server_cb_version_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6323 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
6325 eldbus_message_arguments_append(reply, "ss", VERSION, TIZEN_REL_VERSION);
6330 static Eldbus_Message *
6331 _e_info_server_cb_module_list_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6333 Eina_List *module_list = NULL, *l = NULL;
6334 E_Module *mod = NULL;
6335 Eldbus_Message *reply = NULL;
6336 Eldbus_Message_Iter *iter = NULL, *module_array = NULL;
6337 Eldbus_Message_Iter *inner_module_array = NULL;
6339 module_list = e_module_list();
6340 if (module_list == NULL)
6342 ERR("cannot get module list");
6343 return eldbus_message_error_new(msg, FAIL_TO_GET_PROPERTY,
6344 "module list: e_module_list() returns NULL");
6348 reply = eldbus_message_method_return_new(msg);
6349 iter = eldbus_message_iter_get(reply);
6352 eldbus_message_iter_basic_append(iter, 'i', eina_list_count(module_list));
6355 eldbus_message_iter_arguments_append(iter, "a(si)", &module_array);
6356 EINA_LIST_FOREACH(module_list, l, mod)
6358 char module_name[128] = {0};
6360 snprintf(module_name, sizeof(module_name), "%s", mod->name);
6361 isonoff = e_module_enabled_get(mod);
6362 eldbus_message_iter_arguments_append(module_array, "(si)", &inner_module_array);
6363 eldbus_message_iter_arguments_append(inner_module_array, "si", module_name, isonoff);
6364 eldbus_message_iter_container_close(module_array, inner_module_array);
6366 eldbus_message_iter_container_close(iter, module_array);
6371 static Eldbus_Message *
6372 _e_info_server_cb_module_load(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6374 Eldbus_Message *reply = NULL;
6375 E_Module *module = NULL;
6376 const char *module_name = NULL;
6377 char msg_to_client[128] = {0};
6380 if (eldbus_message_arguments_get(msg, "s", &module_name) == EINA_FALSE || module_name == NULL)
6382 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6383 "module load: an attempt to get arguments from method call message failed");
6386 // find module & enable
6387 module = e_module_find(module_name);
6390 module = e_module_new(module_name);
6392 if (module == NULL || module->error)
6394 snprintf(msg_to_client, sizeof(msg_to_client), "module load: cannot find module name : %s", module_name);
6396 e_object_del(E_OBJECT(module));
6400 if (e_module_enabled_get(module))
6402 snprintf(msg_to_client, sizeof(msg_to_client), "enlightenment module[ %s ] is already loaded", module_name);
6406 res = e_module_enable(module);
6407 snprintf(msg_to_client, sizeof(msg_to_client), "enlightenment module[ %s ] load %s", module_name, res?"succeed":"failed");
6411 // return message to client
6412 reply = eldbus_message_method_return_new(msg);
6413 eldbus_message_arguments_append(reply, "s", msg_to_client);
6418 static Eldbus_Message *
6419 _e_info_server_cb_module_unload(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6421 Eldbus_Message *reply = NULL;
6422 E_Module *module = NULL;
6423 const char *module_name = NULL;
6424 char msg_to_client[128] = {0};
6427 if (eldbus_message_arguments_get(msg, "s", &module_name) == EINA_FALSE || module_name == NULL)
6429 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6430 "module unload: an attempt to get arguments from method call message failed");
6433 module = e_module_find(module_name);
6436 snprintf(msg_to_client, sizeof(msg_to_client), "module unload: cannot find module name : %s", module_name);
6441 if (e_module_enabled_get(module))
6443 res = e_module_disable(module);
6444 snprintf(msg_to_client, sizeof(msg_to_client), "enlightenment module[ %s ] unload %s", module_name, res?"succeed":"failed");
6448 snprintf(msg_to_client, sizeof(msg_to_client), "enlightenment module[ %s ] is already unloaded", module_name);
6454 // return message to client
6455 reply = eldbus_message_method_return_new(msg);
6456 eldbus_message_arguments_append(reply, "s", msg_to_client);
6461 static Eldbus_Message *
6462 _e_info_server_cb_shutdown(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6464 Eldbus_Message *reply = NULL;
6465 char msg_to_client[128] = {0};
6467 snprintf(msg_to_client, sizeof(msg_to_client), "Enlightenment will be shutdown");
6468 reply = eldbus_message_method_return_new(msg);
6469 eldbus_message_arguments_append(reply, "s", msg_to_client);
6471 ecore_main_loop_quit();
6477 static Eldbus_Message *
6478 _e_info_server_cb_buffer_flush(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6480 Eldbus_Message *reply = NULL;
6481 int msg_from_client = 0;
6482 char msg_to_client[128] = {0};
6483 E_Client *ec = NULL;
6484 Ecore_Window win = 0;
6486 if (!eldbus_message_arguments_get(msg, "it", &msg_from_client, &win))
6488 snprintf(msg_to_client, sizeof(msg_to_client), "Error occured while get message");
6495 ec = _e_info_server_ec_find_by_win(win);
6498 snprintf(msg_to_client, sizeof(msg_to_client), "Cannot find win 0x%08zx!", win);
6503 switch (msg_from_client)
6509 // set buffer_flush to specified window
6510 ec->exp_iconify.buffer_flush = msg_from_client;
6511 snprintf(msg_to_client, sizeof(msg_to_client),
6512 "Successfully changed!\n"
6513 "win(0x%08zx/%s)->buffer_flush : %s",
6516 ec->exp_iconify.buffer_flush ? "on" : "off");
6520 // set buffer_flush to all window
6521 e_config->use_buffer_flush = msg_from_client;
6522 for (ec = e_client_top_get(); ec; ec = e_client_below_get(ec))
6524 ec->exp_iconify.buffer_flush = msg_from_client;
6527 snprintf(msg_to_client, sizeof(msg_to_client),
6528 "Successfully changed!\n"
6529 "e_config->use_buffer_flush : %s",
6530 e_config->use_buffer_flush ? "on" : "off");
6534 snprintf(msg_to_client, sizeof(msg_to_client), "Current option: e_config->use_buffer_flush : %s",
6535 e_config->use_buffer_flush ? "on" : "off");
6538 snprintf(msg_to_client + strlen(msg_to_client),
6539 sizeof(msg_to_client) - strlen(msg_to_client),
6540 "\n\t\twin(0x%08zx)->buffer_flush : %s",
6542 ec->exp_iconify.buffer_flush ? "on" : "off");
6548 reply = eldbus_message_method_return_new(msg);
6549 eldbus_message_arguments_append(reply, "s", msg_to_client);
6554 static Eldbus_Message *
6555 _e_info_server_cb_deiconify_approve(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6557 Eldbus_Message *reply = NULL;
6558 int msg_from_client = 0;
6559 char msg_to_client[128] = {0};
6560 E_Client *ec = NULL;
6561 Ecore_Window win = 0;
6563 if (!eldbus_message_arguments_get(msg, "it", &msg_from_client, &win))
6565 snprintf(msg_to_client, sizeof(msg_to_client), "Error occured while get message");
6572 ec = _e_info_server_ec_find_by_win(win);
6575 snprintf(msg_to_client, sizeof(msg_to_client), "Cannot find win 0x%08zx!", win);
6580 switch (msg_from_client)
6586 // set deiconify_approve to specified window
6587 ec->exp_iconify.deiconify_update = msg_from_client;
6588 snprintf(msg_to_client, sizeof(msg_to_client),
6589 "Successfully changed!\n"
6590 "win(0x%08zx/%s)->deiconify_update : %s",
6593 ec->exp_iconify.deiconify_update ? "on" : "off");
6597 // set deiconify_approve to all window
6598 e_config->deiconify_approve = msg_from_client;
6599 for (ec = e_client_top_get(); ec; ec = e_client_below_get(ec))
6601 ec->exp_iconify.deiconify_update = msg_from_client;
6604 snprintf(msg_to_client, sizeof(msg_to_client),
6605 "Successfully changed!\n"
6606 "e_config->deiconify_approve : %s",
6607 e_config->deiconify_approve ? "on" : "off");
6611 snprintf(msg_to_client, sizeof(msg_to_client), "Current option: e_config->deiconify_approve : %s",
6612 e_config->deiconify_approve ? "on" : "off");
6615 snprintf(msg_to_client + strlen(msg_to_client),
6616 sizeof(msg_to_client) - strlen(msg_to_client),
6617 "\n\t\twin(0x%08zx)->deiconify_update : %s",
6619 ec->exp_iconify.deiconify_update ? "on" : "off");
6625 reply = eldbus_message_method_return_new(msg);
6626 eldbus_message_arguments_append(reply, "s", msg_to_client);
6631 static Eldbus_Message *
6632 _e_info_server_cb_key_repeat(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6634 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
6635 const char *path = NULL;
6636 int rate = 0, delay = 0;
6639 if (!eldbus_message_arguments_get(msg, "sii", &path, &delay, &rate))
6641 ERR("Error getting arguments.");
6644 if (!e_comp_wl) return reply;
6646 if (path && strlen(path) > 0)
6648 log_fp = fopen(path, "a");
6649 EINA_SAFETY_ON_NULL_RETURN_VAL(log_fp, reply);
6651 fprintf(log_fp, "\tkeyboard repeat info\n");
6652 fprintf(log_fp, "\t\trate: %d (ms), delay: %d (ms)\n", e_comp_wl->kbd.repeat_rate, e_comp_wl->kbd.repeat_delay);
6658 if (delay <= 0) delay = e_comp_wl->kbd.repeat_delay;
6659 if (rate <= 0) rate = e_comp_wl->kbd.repeat_rate;
6661 e_comp_wl_input_keyboard_repeat_set(delay, rate);
6667 static Eldbus_Message *
6668 _e_info_server_cb_memchecker(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6670 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
6672 if (e_comp->func_memory_dump)
6674 e_comp->func_memory_dump();
6678 e_comp->func_memory_dump = dlsym(RTLD_NEXT, "e_memcheck_dump");
6679 if (e_comp->func_memory_dump)
6680 e_comp->func_memory_dump();
6682 ERR("Not available to dump memory");
6690 _input_rect_timer(void *data)
6692 Evas_Object *rect = (Evas_Object *)data;
6694 evas_object_hide(rect);
6695 evas_object_del(rect);
6697 e_comp_render_queue();
6699 return ECORE_CALLBACK_CANCEL;;
6703 _input_rect_draw(int x, int y, int w, int h, int time, int color_r, int color_g, int color_b)
6706 EINA_SAFETY_ON_NULL_RETURN(e_comp->evas);
6708 rect = evas_object_rectangle_add(e_comp->evas);
6709 EINA_SAFETY_ON_NULL_RETURN(rect);
6711 evas_object_color_set(rect, color_r, color_g, color_b, 150);
6712 evas_object_resize(rect, w, h);
6713 evas_object_move(rect, x, y);
6715 evas_object_layer_set(rect, E_LAYER_DESK_OBJECT_ABOVE);
6717 evas_object_show(rect);
6719 e_comp_render_queue();
6721 ecore_timer_add((double)time, _input_rect_timer, rect);
6725 _input_region_msg_clients_append(Eldbus_Message_Iter *iter, Evas_Object *obj, int time, int color_r, int color_g, int color_b)
6727 Eldbus_Message_Iter *array_of_ec;
6728 Eina_List *list = NULL, *l;
6729 Eina_Rectangle *data;
6732 e_comp_object_input_rect_get(obj, &list);
6735 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
6737 eldbus_message_iter_arguments_append(iter, "a(iiii)", &array_of_ec);
6739 EINA_LIST_FOREACH(list, l, data)
6741 Eldbus_Message_Iter* struct_of_ec;
6743 eldbus_message_iter_arguments_append(array_of_ec, "(iiii)", &struct_of_ec);
6745 eldbus_message_iter_arguments_append(struct_of_ec, "iiii", data->x, data->y, data->w, data->h);
6746 eldbus_message_iter_container_close(array_of_ec, struct_of_ec);
6748 _input_rect_draw(x + data->x, y + data->y, data->w, data->h, time, color_r, color_g, color_b);
6750 eldbus_message_iter_container_close(iter, array_of_ec);
6752 list = eina_list_free(list);
6755 static Eldbus_Message *
6756 _e_info_server_cb_input_region(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6758 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
6759 Eldbus_Message_Iter *iter = eldbus_message_iter_get(reply);
6764 uint64_t win_id_value = 0;
6765 const char *win_id_str = NULL;
6766 unsigned long tmp = 0;
6767 int time = 0, color_r = 0, color_g = 0, color_b = 0;
6768 Eina_Bool res = EINA_FALSE;
6770 if (!eldbus_message_arguments_get(msg, "siiii", &win_id_str, &time, &color_r, &color_g, &color_b))
6772 ERR("Error getting arguments.");
6775 if (!e_comp) return reply;
6777 if (strlen(win_id_str) >= 2 && win_id_str[0] == '0' && win_id_str[1] == 'x')
6778 res = e_util_string_to_ulong(win_id_str, &tmp, 16);
6780 res = e_util_string_to_ulong(win_id_str, &tmp, 10);
6781 if (res == EINA_FALSE)
6783 ERR("input_region: invalid input arguments");
6784 return eldbus_message_error_new(msg, INVALID_ARGS,
6785 "input_region: invalid input arguments");
6787 win_id_value = (uint64_t)tmp;
6789 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
6791 ec = evas_object_data_get(o, "E_Client");
6793 if (e_client_util_ignored_get(ec)) continue;
6795 win = e_client_util_win_get(ec);
6796 if (!win || win != win_id_value) continue;
6798 _input_region_msg_clients_append(iter, o, time, color_r, color_g, color_b);
6805 static Eldbus_Message *
6806 _e_info_server_cb_hwc_wins_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6808 Eldbus_Message *reply;
6809 E_Hwc_Wins_Debug_Cmd cmd;
6811 if (!eldbus_message_arguments_get(msg, "i", &cmd))
6813 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6814 "hwc_wins: an attempt to get arguments from method call message failed");
6817 reply = eldbus_message_method_return_new(msg);
6818 e_hwc_windows_debug_info_get(eldbus_message_iter_get(reply), cmd);
6823 static Eldbus_Message *
6824 _e_info_server_cb_screen_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6826 Eldbus_Message *reply;
6827 E_Hwc_Wins_Debug_Cmd cmd;
6829 if (!eldbus_message_arguments_get(msg, "i", &cmd))
6831 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6832 "screen_info: an attempt to get arguments from method call message failed");
6835 reply = eldbus_message_method_return_new(msg);
6836 e_comp_screen_debug_info_get(eldbus_message_iter_get(reply));
6841 static Eldbus_Message *
6842 _e_info_server_cb_focus_policy_ext_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6844 Eldbus_Message *reply;
6845 int option = 0, res = -1, previous_policy;
6846 Eina_Bool changed = EINA_FALSE;
6848 if (!eldbus_message_arguments_get(msg, "i", &option))
6850 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
6851 "focus_policy_ext_set: an attempt to get argument from method call message failed");
6854 previous_policy = e_config->focus_policy_ext;
6859 // get now focus policy ext
6862 // use topmost focus
6863 e_config->focus_policy_ext = E_FOCUS_EXT_TOP_STACK;
6867 // use focus history
6868 e_config->focus_policy_ext = E_FOCUS_EXT_HISTORY;
6872 res = e_config->focus_policy_ext;
6873 if (previous_policy != res)
6875 E_Zone *zone = e_zone_current_get();
6876 if (zone && zone->focus)
6878 e_focus_del(zone->focus);
6879 zone->focus = e_focus_new(zone, res);
6881 ERR("Failed to create E_Focus.");
6883 changed = EINA_TRUE;
6886 reply = eldbus_message_method_return_new(msg);
6887 eldbus_message_arguments_append(reply, "bi", changed, res);
6892 static Eldbus_Message *
6893 _e_info_server_cb_focus_history(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6895 Eldbus_Message *reply = NULL;
6900 static Eldbus_Message *
6901 _e_info_server_cb_init_device(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6903 Eldbus_Message *reply;
6904 char *name = NULL, *result = NULL;
6905 unsigned int type = 0x0;
6907 if (!eldbus_message_arguments_get(msg, "us", &type, &name))
6909 return eldbus_message_error_new(msg, "InputUtilFailed",
6910 "input: an attempt to excute input util from method call message failed");
6913 result = e_info_server_input_init_device(type, name);
6915 reply = eldbus_message_method_return_new(msg);
6917 eldbus_message_arguments_append(reply, "s", result);
6922 static Eldbus_Message *
6923 _e_info_server_cb_deinit_device(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6925 Eldbus_Message *reply;
6927 e_info_server_input_deinit_device();
6929 reply = eldbus_message_method_return_new(msg);
6934 static Eldbus_Message *
6935 _e_info_server_cb_keygen(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6937 Eldbus_Message *reply;
6938 char *name = NULL, *result = NULL;
6939 int code = 0, state = 0;
6941 if (!eldbus_message_arguments_get(msg, "sii", &name, &code, &state))
6943 return eldbus_message_error_new(msg, "KeygenFailed",
6944 "keygen: an attempt to generate key event from method call message failed");
6947 result = e_info_server_input_keygen(name, code, state);
6948 reply = eldbus_message_method_return_new(msg);
6950 eldbus_message_arguments_append(reply, "s", result);
6955 static Eldbus_Message *
6956 _e_info_server_cb_touchgen(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6958 Eldbus_Message *reply;
6959 char *result = NULL;
6960 int idx = 0, x = -1, y = -1, state = 0;
6962 if (!eldbus_message_arguments_get(msg, "iiii", &idx, &x, &y, &state))
6964 return eldbus_message_error_new(msg, "TouchgenFailed",
6965 "toutgen: an attempt to generate touch event from method call message failed");
6968 result = e_info_server_input_touchgen(idx, x, y, state);
6969 reply = eldbus_message_method_return_new(msg);
6971 eldbus_message_arguments_append(reply, "s", result);
6976 static Eldbus_Message *
6977 _e_info_server_cb_mousegen(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
6979 Eldbus_Message *reply;
6980 char *result = NULL;
6981 int button = 0, x = -1, y = -1, state = 0;
6983 if (!eldbus_message_arguments_get(msg, "iiii", &button, &x, &y, &state))
6985 return eldbus_message_error_new(msg, "MousegenFailed",
6986 "mousegen: an attempt to generate mouse event from method call message failed");
6989 result = e_info_server_input_mousegen(button, x, y, state);
6990 reply = eldbus_message_method_return_new(msg);
6992 eldbus_message_arguments_append(reply, "s", result);
6997 static Eldbus_Message *
6998 _e_info_server_cb_mouse_accel(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7000 Eldbus_Message *reply;
7001 char *result = NULL;
7004 if (!eldbus_message_arguments_get(msg, "i", &state))
7006 return eldbus_message_error_new(msg, "Mouse_accelFailed",
7007 "mouse_accel: an attempt to set mouse acceleration usage from method call message failed");
7010 result = e_info_server_input_mouse_accel_set(state);
7011 reply = eldbus_message_method_return_new(msg);
7013 eldbus_message_arguments_append(reply, "s", result);
7018 static Eldbus_Message *
7019 _e_info_server_cb_input_log_enable(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7021 Eldbus_Message *reply;
7022 char *result = NULL;
7025 if (!eldbus_message_arguments_get(msg, "i", &state))
7027 return eldbus_message_error_new(msg, "Input_log_enableFailed",
7028 "input_log: an attempt to set input_log enable from method call message failed");
7031 result = e_info_server_input_log_enable_set(state);
7032 reply = eldbus_message_method_return_new(msg);
7034 eldbus_message_arguments_append(reply, "s", result);
7039 static Eldbus_Message *
7040 _e_info_server_cb_use_cursor_timer(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7042 Eldbus_Message *reply;
7043 char *result = NULL;
7046 if (!eldbus_message_arguments_get(msg, "i", &state))
7048 return eldbus_message_error_new(msg, "Use_cursor_timerFailed",
7049 "cursor_timer: an attempt to set use_cursor_timer from method call message failed");
7052 e_comp_wl_input_cursor_timer_enable_set(state);
7053 result = E_INFO_INPUT_RESULT_NONE;
7054 reply = eldbus_message_method_return_new(msg);
7056 eldbus_message_arguments_append(reply, "s", result);
7061 static Eldbus_Message *
7062 _e_info_server_cb_filter(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7064 Eldbus_Message *reply;
7066 const char *filter_name = NULL, *win_str = NULL;
7067 char msg_to_client[125] = {0};
7068 unsigned long tmp = 0;
7069 uint64_t win_number = 0;
7075 if (!eldbus_message_arguments_get(msg, "sis", &win_str, &onoff, &filter_name))
7077 return eldbus_message_error_new(msg, GET_CALL_MSG_ARG_ERR,
7078 "filetr: failed to get arguments from method call message");
7080 reply = eldbus_message_method_return_new(msg);
7082 if (strlen(win_str) >= 2 && win_str[0] == '0' && win_str[1] == 'x')
7083 res = e_util_string_to_ulong(win_str, &tmp, 16);
7085 res = e_util_string_to_ulong(win_str, &tmp, 10);
7089 snprintf(msg_to_client, sizeof(msg_to_client), "Invalid window id: %s\n", win_str);
7093 win_number = (uint64_t)tmp;
7095 if (win_number != 0x0)
7097 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
7099 ec = evas_object_data_get(o, "E_Client");
7101 win = e_client_util_win_get(ec);
7102 if (win != win_number) continue;
7106 e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_NONE);
7107 snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter has been unset.\n", win_str);
7111 if (!strcmp(filter_name, "blur"))
7113 e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_BLUR);
7114 snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is set!", win_str, filter_name);
7116 else if (!strcmp(filter_name, "grayscale"))
7118 e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_GRAYSCALE);
7119 snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is set!", win_str, filter_name);
7121 else if (!strcmp(filter_name, "inverse_color"))
7123 e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_INVERSE);
7124 snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is set!", win_str, filter_name);
7128 e_comp_object_image_filter_set(ec->frame, E_COMP_IMAGE_FILTER_NONE);
7129 snprintf(msg_to_client, sizeof(msg_to_client), "%s window filter %s is NOT supported!", win_str, filter_name);
7133 e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
7134 e_comp_object_dirty(ec->frame);
7135 e_comp_object_render(ec->frame);
7139 snprintf(msg_to_client, sizeof(msg_to_client), "Invalid window id: %s\n", win_str);
7145 char current_filter[15] = {0};
7146 //return current filter mode
7147 switch (e_comp->image_filter)
7149 case E_COMP_IMAGE_FILTER_BLUR:
7150 snprintf(current_filter, sizeof(current_filter), "blur");
7152 case E_COMP_IMAGE_FILTER_GRAYSCALE:
7153 snprintf(current_filter, sizeof(current_filter), "grayscale");
7155 case E_COMP_IMAGE_FILTER_INVERSE:
7156 snprintf(current_filter, sizeof(current_filter), "inverse_color");
7159 snprintf(current_filter, sizeof(current_filter), "none");
7163 snprintf(msg_to_client, sizeof(msg_to_client),
7164 "Current filter : %s\n", current_filter);
7166 else if (onoff == 0)
7168 e_comp_image_filter_set(E_COMP_IMAGE_FILTER_NONE);
7169 snprintf(msg_to_client, sizeof(msg_to_client),
7170 "Filter has been unset.\n");
7174 if (!strcmp(filter_name, "blur"))
7175 e_comp_image_filter_set(E_COMP_IMAGE_FILTER_BLUR);
7176 else if (!strcmp(filter_name, "grayscale"))
7177 e_comp_image_filter_set(E_COMP_IMAGE_FILTER_GRAYSCALE);
7178 else if (!strcmp(filter_name, "inverse_color"))
7179 e_comp_image_filter_set(E_COMP_IMAGE_FILTER_INVERSE);
7181 snprintf(msg_to_client, sizeof(msg_to_client),
7182 "Filter %s is NOT supported!\n",
7185 snprintf(msg_to_client, sizeof(msg_to_client),
7186 "Filter %s is set!\n", filter_name);
7190 eldbus_message_arguments_append(reply, "s", msg_to_client);
7195 static Eldbus_Message *
7196 _e_info_server_cb_mtrace(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7198 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7201 if (!eldbus_message_arguments_get(msg, "i", &enable))
7203 ERR("Error getting argument for enabling mtrace.");
7210 INF("mtrace enable=%d", enable);
7215 INF("mtrace enable=0");
7221 static Eldbus_Message *
7222 _e_info_server_cb_gcov(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7224 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7227 if (!eldbus_message_arguments_get(msg, "i", &mode))
7229 ERR("Error getting arguments.");
7233 #ifdef TIZEN_TEST_GCOV
7241 _e_info_server_basic_operation_request(E_Client *ec, const char *operation)
7244 if (!operation) return;
7246 if (!e_util_strcmp("lower", operation))
7248 e_policy_wl_generate_request(ec, E_POLICY_WL_GENERATE_REQUEST_LOWER);
7250 else if (!e_util_strcmp("activate", operation))
7252 e_policy_wl_generate_request(ec, E_POLICY_WL_GENERATE_REQUEST_ACTIVATE);
7254 else if (!e_util_strcmp("iconify", operation))
7256 e_policy_wl_generate_request(ec, E_POLICY_WL_GENERATE_REQUEST_ICONIFY);
7258 else if (!e_util_strcmp("uniconify", operation))
7260 e_policy_wl_generate_request(ec, E_POLICY_WL_GENERATE_REQUEST_UNICONIFY);
7264 ERR("Not supported operation (%s)", operation);
7268 static Eldbus_Message *
7269 _e_info_server_cb_basic_operation_generate(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7271 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7272 const char *win_str, *operation;
7273 unsigned long tmp = 0;
7274 uint64_t win_id = 0;
7277 Eina_Bool res = EINA_FALSE;
7281 ERR("e_policy is not initialized!");
7285 if (!eldbus_message_arguments_get(msg, "ss", &win_str, &operation))
7287 ERR("Error getting arguments.");
7291 res = e_util_string_to_ulong(win_str, &tmp, 16);
7292 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
7294 win_id = (uint64_t)tmp;
7296 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
7298 ec = evas_object_data_get(o, "E_Client");
7301 Ecore_Window win = e_client_util_win_get(ec);
7305 _e_info_server_basic_operation_request(ec, operation);
7313 static Eldbus_Message *
7314 _e_info_server_cb_process_info(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7316 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7317 e_process_info_print();
7321 static Eldbus_Message *
7322 _e_info_server_cb_zone_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7324 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7325 unsigned long tmp = 0;
7326 const char *win_id_str = NULL;
7328 uint64_t win_id = 0;
7329 Evas_Object *o = NULL;
7330 E_Client *ec = NULL;
7331 E_Zone *zone = NULL;
7332 Eina_Bool res = EINA_FALSE;
7334 if (!eldbus_message_arguments_get(msg, "si", &win_id_str, &zone_id))
7336 ERR("Error getting arguments.");
7340 if (strlen(win_id_str) >= 2 && win_id_str[0] == '0' && win_id_str[1] == 'x')
7341 res = e_util_string_to_ulong(win_id_str, &tmp, 16);
7343 res = e_util_string_to_ulong(win_id_str, &tmp, 10);
7345 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
7347 win_id = (uint64_t)tmp;
7349 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
7351 ec = evas_object_data_get(o, "E_Client");
7356 win = e_client_util_win_get(ec);
7357 if (win != win_id) continue;
7359 zone = e_zone_get_by_id(zone_id);
7362 e_zone_client_add(zone, ec);
7371 static Eldbus_Message *
7372 _e_info_server_cb_input_output_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7374 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7375 const char *input_name = NULL, *output_name = NULL;
7376 Eina_Bool res = EINA_FALSE;
7378 if (!eldbus_message_arguments_get(msg, "ss", &input_name, &output_name))
7380 ERR("Error getting arguments.");
7384 res = e_input_device_output_name_set(NULL, input_name, output_name);
7385 if (res) INF("Succeeded to set input device(%s)'s output name(%s)", input_name, output_name);
7386 else ERR("Failed to set input device(%s)'s output name(%s)", input_name, output_name);
7391 static Eldbus_Message *
7392 _e_info_server_cb_input_seat_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7394 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7395 const char *input_name = NULL, *seat_name = NULL;
7396 Eina_Bool res = EINA_FALSE;
7398 if (!eldbus_message_arguments_get(msg, "ss", &input_name, &seat_name))
7400 ERR("Error getting arguments.");
7404 res = e_input_device_seat_name_set(NULL, input_name, seat_name);
7405 if (res) INF("Succeeded to set input device(%s)'s seat name(%s)", input_name, seat_name);
7406 else ERR("Failed to set input device(%s)'s seat name(%s)", input_name, seat_name);
7411 static Eldbus_Message *
7412 e_info_server_cb_resize_ppu_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7414 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7415 unsigned long tmp = 0;
7416 const char *win_id_str = NULL;
7417 uint64_t win_id = 0;
7418 Evas_Object *o = NULL;
7419 E_Client *ec = NULL;
7421 Eina_Bool res = EINA_FALSE;
7423 if (!eldbus_message_arguments_get(msg, "si", &win_id_str, &ppu))
7425 ERR("Error getting arguments.");
7429 if (strlen(win_id_str) >= 2 && win_id_str[0] == '0' && win_id_str[1] == 'x')
7430 res = e_util_string_to_ulong(win_id_str, &tmp, 16);
7432 res = e_util_string_to_ulong(win_id_str, &tmp, 10);
7434 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
7436 win_id = (uint64_t)tmp;
7438 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
7440 ec = evas_object_data_get(o, "E_Client");
7445 win = e_client_util_win_get(ec);
7446 if (win != win_id) continue;
7448 e_client_resize_unit_size_set(ec, ppu);
7457 _e_info_server_prop_set(E_Client *ec, const char *property, int set)
7460 if (!property) return;
7462 if (!e_util_strcmp("pin", property))
7464 e_client_pinned_set(ec, set);
7468 ERR("Not supported operation (%s)", property);
7472 static Eldbus_Message *
7473 _e_info_server_cb_prop_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7475 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7476 const char *win_str, *property;
7478 unsigned long tmp = 0;
7479 uint64_t win_id = 0;
7482 Eina_Bool res = EINA_FALSE;
7484 if (!eldbus_message_arguments_get(msg, "ssi", &win_str, &property, &value))
7486 ERR("Error getting arguments.");
7490 res = e_util_string_to_ulong(win_str, &tmp, 16);
7491 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, reply);
7493 win_id = (uint64_t)tmp;
7495 for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
7497 ec = evas_object_data_get(o, "E_Client");
7500 Ecore_Window win = e_client_util_win_get(ec);
7504 _e_info_server_prop_set(ec, property, value);
7512 static Eldbus_Message *
7513 _e_info_server_cb_input_subtype_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7515 Eldbus_Message *reply;
7516 const char *input_name = NULL, *subtype_name = NULL;
7517 char *result = NULL;
7518 Eina_Bool res = EINA_FALSE;
7520 if (!eldbus_message_arguments_get(msg, "ss", &input_name, &subtype_name))
7522 return eldbus_message_error_new(msg, "Input_subtype_setFailed",
7523 "input_subtype_set: an attempt to set device's subtype from method call message failed");;
7526 res = e_input_device_subtype_set(NULL, input_name, subtype_name);
7529 INF("Succeeded to set input device(%s)'s subtype(%s)", input_name, subtype_name);
7530 result = E_INFO_INPUT_RESULT_NONE;
7534 ERR("Failed to set input device(%s)'s subtype(%s)", input_name, subtype_name);
7535 result = "Failed to set subtype";
7538 reply = eldbus_message_method_return_new(msg);
7539 eldbus_message_arguments_append(reply, "s", result);
7544 static Eldbus_Message *
7545 _e_info_server_cb_kvm_transparent_set(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
7547 Eldbus_Message *reply = eldbus_message_method_return_new(msg);
7550 if (!eldbus_message_arguments_get(msg, "i", &set))
7552 ERR("Failed to get argument");
7558 e_service_kvm_all_kvm_service_transparent_set(EINA_TRUE);
7562 e_service_kvm_all_kvm_service_transparent_set(EINA_FALSE);
7568 //{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG },
7569 static const Eldbus_Method methods[] = {
7570 { "get_window_info", NULL, ELDBUS_ARGS({"iiiiisiiia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
7571 { "get_ec_info", NULL, ELDBUS_ARGS({"iia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}),_e_info_server_cb_ec_info_get, 0 },
7572 { "get_all_ec_info", NULL, ELDBUS_ARGS({"iia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}),_e_info_server_cb_all_ec_info_get, 0 },
7573 { "get_all_window_info", NULL, ELDBUS_ARGS({"iia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_all_window_info_get, 0 },
7574 { "get_zone_info", NULL, ELDBUS_ARGS({"("VALUE_TYPE_FOR_ZONE")", "array of zone"}), _e_info_server_cb_zone_info_get, 0 },
7575 { "compobjs", NULL, ELDBUS_ARGS({"a("SIGNATURE_COMPOBJS_CLIENT")", "array of comp objs"}), _e_info_server_cb_compobjs, 0 },
7576 { "subsurface", NULL, ELDBUS_ARGS({"a("SIGNATURE_SUBSURFACE")", "array of ec"}), _e_info_server_cb_subsurface, 0 },
7577 { "dump_wins", ELDBUS_ARGS({SIGNATURE_DUMP_WINS, "directory"}), ELDBUS_ARGS({"s", "result of dump"}), _e_info_server_cb_wins_dump, 0 },
7578 { "set_force_visible", ELDBUS_ARGS({SIGNATURE_FORCE_VISIBLE_CLIENT, "obj"}), ELDBUS_ARGS({SIGNATURE_FORCE_VISIBLE_SERVER, "msg"}), _e_info_server_cb_force_visible, 0 },
7579 { "eina_log_levels", ELDBUS_ARGS({"s", "eina log levels"}), NULL, _e_info_server_cb_eina_log_levels, 0 },
7580 { "eina_log_path", ELDBUS_ARGS({"s", "eina log path"}), NULL, _e_info_server_cb_eina_log_path, 0 },
7582 { "dlog", ELDBUS_ARGS({"i", "using dlog"}), NULL, _e_info_server_cb_dlog_switch, 0},
7584 { "get_window_prop", ELDBUS_ARGS({"usss", "prop_manage_request"}), ELDBUS_ARGS({"a(ss)", "array_of_ec"}), _e_info_server_cb_window_prop_get, 0},
7585 { "get_connected_clients", NULL, ELDBUS_ARGS({"a(ss)", "array of ec"}), _e_info_server_cb_connected_clients_get, 0 },
7586 { "rotation_query", ELDBUS_ARGS({"i", "query_rotation"}), NULL, _e_info_server_cb_rotation_query, 0},
7587 { "rotation_message", ELDBUS_ARGS({"iii", "rotation_message"}), NULL, _e_info_server_cb_rotation_message, 0},
7588 { "get_res_lists", ELDBUS_ARGS({VALUE_TYPE_REQUEST_RESLIST, "client resource"}), ELDBUS_ARGS({"a("VALUE_TYPE_REPLY_RESLIST")", "array of client resources"}), _e_info_server_cb_res_lists_get, 0 },
7589 { "get_input_devices", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_INPUTDEV")", "array of input"}), _e_info_server_cb_input_device_info_get, 0},
7590 { "protocol_trace", ELDBUS_ARGS({"s", "protocol_trace"}), NULL, _e_info_server_cb_protocol_trace, 0},
7591 { "protocol_rule", ELDBUS_ARGS({"sss", "protocol_rule"}), ELDBUS_ARGS({"s", "rule request"}), _e_info_server_cb_protocol_rule, 0},
7592 { "bgcolor_set", ELDBUS_ARGS({"iiii", "bgcolor_set"}), NULL, _e_info_server_cb_bgcolor_set, 0},
7593 { "punch", ELDBUS_ARGS({"iiiiiiiii", "punch_geometry"}), NULL, _e_info_server_cb_punch, 0},
7594 { "transform_message", ELDBUS_ARGS({"siiiiiiiis", "transform_message"}), NULL, e_info_server_cb_transform_message, 0},
7595 { "dump_buffers", ELDBUS_ARGS({"iisdis", "dump_buffers"}), ELDBUS_ARGS({"is", "dump_buffers reply"}), _e_info_server_cb_buffer_dump, 0 },
7596 { "dump_selected_buffers", ELDBUS_ARGS({"ss", "dump_selected_buffers"}), ELDBUS_ARGS({"s", "result of dump"}), _e_info_server_cb_selected_buffer_dump, 0 },
7597 { "dump_screen", ELDBUS_ARGS({"s", "dump_screen"}), NULL, _e_info_server_cb_screen_dump, 0 },
7598 { "output_mode", ELDBUS_ARGS({SIGNATURE_OUTPUT_MODE_CLIENT, "output mode"}), ELDBUS_ARGS({"a("SIGNATURE_OUTPUT_MODE_SERVER")", "array of ec"}), _e_info_server_cb_output_mode, 0 },
7599 { "trace_message_hwc", ELDBUS_ARGS({"i", "trace_message_hwc"}), NULL, e_info_server_cb_hwc_trace_message, 0},
7600 { "trace_message_prstt", ELDBUS_ARGS({"i", "trace_message_presentation_time"}), NULL, e_info_server_cb_prstt_trace_message, 0},
7601 { "trace_message_exsync", ELDBUS_ARGS({"i", "trace_message_ex_sync"}), NULL, e_info_server_cb_exsync_trace_message, 0},
7602 { "trace_message_damage", ELDBUS_ARGS({"i", "trace_message_damage"}), NULL, e_info_server_cb_damage_trace_message, 0},
7603 { "hwc", ELDBUS_ARGS({"i", "hwc"}), NULL, e_info_server_cb_hwc, 0},
7604 { "show_plane_state", NULL, NULL, e_info_server_cb_show_plane_state, 0},
7605 { "show_pending_commit", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_PENDING_COMMIT")", "array of pending commit"}), e_info_server_cb_show_pending_commit, 0},
7606 { "get_fps_info", ELDBUS_ARGS({"s", "fps request"}), ELDBUS_ARGS({"a("VALUE_TYPE_FOR_FPS")", "array of fps"}), _e_info_server_cb_fps_info_get, 0},
7607 { "get_keymap", NULL, ELDBUS_ARGS({"hi", "keymap fd"}), _e_info_server_cb_keymap_info_get, 0},
7608 { "effect_control", ELDBUS_ARGS({"i", "effect_control"}), NULL, e_info_server_cb_effect_control, 0},
7609 { "quickpanel_control", ELDBUS_ARGS({"i", "operation"}, {"s","window id" }), NULL, e_info_server_cb_quickpanel_control, 0},
7610 { "get_keygrab_status", ELDBUS_ARGS({"s", "get_keygrab_status"}), NULL, _e_info_server_cb_keygrab_status_get, 0},
7611 { "get_module_info", ELDBUS_ARGS({"ss", "get_module_info"}), NULL, _e_info_server_cb_module_info_get, 0},
7612 { "aux_msg", ELDBUS_ARGS({"s","window id" }, {"s", "key"}, {"s", "value"}, {"as", "options"}), NULL, e_info_server_cb_aux_message, 0},
7613 { "aux_hint_add", ELDBUS_ARGS({"s","window id" }, {"u", "hint id"}, {"s", "hint"}, {"s", "value"}), NULL, e_info_server_cb_aux_hint_add, 0},
7614 { "aux_hint_del", ELDBUS_ARGS({"s","window id" }, {"u", "hint id"}), NULL, e_info_server_cb_aux_hint_del, 0},
7615 { "scrsaver", ELDBUS_ARGS({SIGNATURE_SCRSAVER_CLIENT, "scrsaver_params"}), ELDBUS_ARGS({SIGNATURE_SCRSAVER_SERVER, "scrsaver_result"}), _e_info_server_cb_scrsaver, 0},
7616 { "desktop_geometry_set", ELDBUS_ARGS({"iiii", "Geometry"}), NULL, _e_info_server_cb_desktop_geometry_set, 0},
7617 { "desktop_window_control", ELDBUS_ARGS({"i", "Window Control option"}), NULL, _e_info_server_cb_desktop_window_control, 0},
7618 { "desk_zoom", ELDBUS_ARGS({"ddii", "Zoom"}), NULL, _e_info_server_cb_desk_zoom, 0},
7619 { "desk_area_info", NULL, NULL, _e_info_server_cb_desk_area_info, 0},
7620 { "desk_area_enable", ELDBUS_ARGS({"i", "enable"}), NULL, _e_info_server_cb_desk_area_enable, 0},
7621 { "desk_area_new_sub1", ELDBUS_ARGS({"iiiii", "geometry"}), NULL, _e_info_server_cb_desk_area_new_sub1, 0},
7622 { "desk_area_new_sub2", ELDBUS_ARGS({"iiiii", "geometry"}), NULL, _e_info_server_cb_desk_area_new_sub2, 0},
7623 { "desk_area_remove_sub", ELDBUS_ARGS({"i", "sub_id"}), NULL, _e_info_server_cb_desk_area_remove_sub, 0},
7624 { "desk_area_base_raise", ELDBUS_ARGS({"i", "raise"}), NULL, _e_info_server_cb_desk_area_base_raise, 0},
7625 { "desk_area_sub1_raise", ELDBUS_ARGS({"i", "raise"}), NULL, _e_info_server_cb_desk_area_sub1_raise, 0},
7626 { "desk_area_sub2_raise", ELDBUS_ARGS({"i", "raise"}), NULL, _e_info_server_cb_desk_area_sub2_raise, 0},
7627 { "desk_area_check_stack", NULL, NULL, _e_info_server_cb_desk_area_check_stack, 0},
7628 { "frender", ELDBUS_ARGS({"i", "frender"}), ELDBUS_ARGS({"s", "force_render_result"}), _e_info_server_cb_force_render, 0},
7629 { "screen_rotation_pre", ELDBUS_ARGS({"i", "value"}), NULL, _e_info_server_cb_screen_rotation_pre, 0},
7630 { "screen_rotation", ELDBUS_ARGS({"i", "value"}), NULL, _e_info_server_cb_screen_rotation, 0},
7631 { "remote_surface", ELDBUS_ARGS({"ii", "remote surface query"}), ELDBUS_ARGS({"as", "remote surfac information"}), _e_info_server_cb_remote_surface, 0},
7632 { "get_win_under_touch", NULL, ELDBUS_ARGS({"i", "result"}), _e_info_server_cb_get_win_under_touch, 0 },
7633 { "kill_client", ELDBUS_ARGS({VALUE_TYPE_REQUEST_FOR_KILL, "window"}), ELDBUS_ARGS({"a"VALUE_TYPE_REPLY_KILL, "kill result"}), _e_info_server_cb_kill_client, 0 },
7634 { "get_window_name", ELDBUS_ARGS({"t", "window"}), ELDBUS_ARGS({"s", "window name"}), _e_info_server_cb_get_window_name, 0 },
7635 { "get_windows", ELDBUS_ARGS({"is", "mode, value"}), ELDBUS_ARGS({"at", "array_of_windows"}), _e_info_server_cb_get_windows, 0 },
7636 { "wininfo", ELDBUS_ARGS({VALUE_TYPE_REQUEST_FOR_WININFO, "window"}), ELDBUS_ARGS({VALUE_TYPE_REPLY_WININFO, "window info"}), _e_info_server_cb_wininfo, 0 },
7637 { "wininfo_tree", ELDBUS_ARGS({VALUE_TYPE_REQUEST_FOR_WININFO_TREE, "wininfo_tree"}), ELDBUS_ARGS({VALUE_TYPE_REPLY_WININFO_TREE, "window tree info"}), _e_info_server_cb_wininfo_tree, 0 },
7638 { "wininfo_hints", ELDBUS_ARGS({"it", "mode, window"}), ELDBUS_ARGS({"as", "window hints"}), _e_info_server_cb_wininfo_hints, 0 },
7639 { "wininfo_shape", ELDBUS_ARGS({"t", "window"}), ELDBUS_ARGS({"ia(iiii)ia(iiii)", "window shape"}), _e_info_server_cb_wininfo_shape, 0 },
7640 { "get_version", NULL, ELDBUS_ARGS({"ss", "version of E20"}), _e_info_server_cb_version_get, 0 },
7641 { "module_list_get", NULL, ELDBUS_ARGS({"ia(si)", "module list"}), _e_info_server_cb_module_list_get, 0 },
7642 { "module_load", ELDBUS_ARGS({"s", "target module"}), ELDBUS_ARGS({"s", "load result"}), _e_info_server_cb_module_load, 0 },
7643 { "module_unload", ELDBUS_ARGS({"s", "target module"}), ELDBUS_ARGS({"s", "unload result"}), _e_info_server_cb_module_unload, 0 },
7644 { "shutdown", NULL, ELDBUS_ARGS({"s", "shutdown result"}), _e_info_server_cb_shutdown, 0 },
7645 { "buffer_flush", ELDBUS_ARGS({"it", "option"}), ELDBUS_ARGS({"s", "buffer_flush status"}), _e_info_server_cb_buffer_flush, 0},
7646 { "deiconify_approve", ELDBUS_ARGS({"it", "option"}), ELDBUS_ARGS({"s", "deiconify_approve status"}), _e_info_server_cb_deiconify_approve, 0},
7647 { "key_repeat", ELDBUS_ARGS({"sii", "option"}), NULL, _e_info_server_cb_key_repeat, 0},
7648 { "mtrace", ELDBUS_ARGS({"i", "enable"}), NULL, _e_info_server_cb_mtrace, 0},
7649 { "dump_memchecker", NULL, NULL, _e_info_server_cb_memchecker, 0},
7650 { "magnifier", ELDBUS_ARGS({"i", "magnifier"}), NULL, e_info_server_cb_magnifier, 0},
7651 { "input_region", ELDBUS_ARGS({"siiii", "options"}), ELDBUS_ARGS({"a(iiii)", "path"}), _e_info_server_cb_input_region, 0},
7652 { "hwc_wins", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"as", "hwc wins info"}), _e_info_server_cb_hwc_wins_info_get, 0 },
7653 { "screen_info", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"as", "screen info"}), _e_info_server_cb_screen_info_get, 0 },
7654 { "focus_policy_ext_set", ELDBUS_ARGS({"i", "option"}), ELDBUS_ARGS({"bi", "isChanged and result"}), _e_info_server_cb_focus_policy_ext_set, 0 },
7655 { "focus_history", NULL, ELDBUS_ARGS({"a(ubbbs)", "history array"}), _e_info_server_cb_focus_history, 0 },
7656 { "init_device", ELDBUS_ARGS({"us", "device information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_init_device, 0},
7657 { "deinit_device", NULL, NULL, _e_info_server_cb_deinit_device, 0},
7658 { "keygen", ELDBUS_ARGS({"sii", "key information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_keygen, 0},
7659 { "touchgen", ELDBUS_ARGS({"iiii", "touch information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_touchgen, 0},
7660 { "mousegen", ELDBUS_ARGS({"iiii", "mouse information"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_mousegen, 0},
7661 { "mouse_accel", ELDBUS_ARGS({"i", "set mouse acceleration"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_mouse_accel, 0},
7662 { "input_log_enable", ELDBUS_ARGS({"i", "set input log enable"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_input_log_enable, 0},
7663 { "use_cursor_timer", ELDBUS_ARGS({"i", "set use_cursor_timer enable"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_use_cursor_timer, 0},
7664 { "filter", ELDBUS_ARGS({"sis", "win_id, on(1)/off(0), filter name"}), ELDBUS_ARGS({"s", "result of request"}), _e_info_server_cb_filter, 0},
7665 { "gcov", ELDBUS_ARGS({"i", "option"}), NULL, _e_info_server_cb_gcov, 0},
7666 { "basic_op_gen", ELDBUS_ARGS({"s","window id" }, {"s", "operation"}), NULL, _e_info_server_cb_basic_operation_generate, 0},
7667 { "process_info", NULL, ELDBUS_ARGS({"s", "process information"}), _e_info_server_cb_process_info, 0 },
7668 { "zone_set", ELDBUS_ARGS({"si", "zone set"}), NULL, _e_info_server_cb_zone_set, 0 },
7669 { "input_output_set", ELDBUS_ARGS({"ss", "set input device's output name"}), NULL, _e_info_server_cb_input_output_set, 0 },
7670 { "input_seat_set", ELDBUS_ARGS({"ss", "set input device's seat"}), NULL, _e_info_server_cb_input_seat_set, 0 },
7671 { "resize_ppu_set", ELDBUS_ARGS({"si", "set resize ppu"}), NULL, e_info_server_cb_resize_ppu_set, 0},
7672 { "prop_set", ELDBUS_ARGS({"s","window id" }, {"s", "property"}, {"i", "set value"}), NULL, _e_info_server_cb_prop_set, 0},
7673 { "input_subtype_set", ELDBUS_ARGS({"ss", "set input device's subtype(subclas)"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_input_subtype_set, 0 },
7674 { "kvm_transparent", ELDBUS_ARGS({"i", "set kvm service window to transparent"}), NULL, _e_info_server_cb_kvm_transparent_set, 0 },
7675 { NULL, NULL, NULL, NULL, 0 }
7678 static const Eldbus_Signal signals[] = {
7679 [E_INFO_SERVER_SIGNAL_WIN_UNDER_TOUCH] = {"win_under_touch", ELDBUS_ARGS({ "t", "win_under_touch" }), 0},
7683 static const Eldbus_Service_Interface_Desc iface_desc = {
7684 IFACE, methods, signals, NULL, NULL, NULL
7688 e_info_server_protocol_rule_path_init(char *rule_path)
7691 int len = sizeof (reply);
7695 if (!rule_path || strlen(rule_path) <= 0)
7699 argv[1] = rule_path;
7701 e_info_protocol_rule_set(argc, (const char**)&(argv[0]), reply, &len);
7703 INF("%s: rule_path : %s\n", __func__, rule_path);
7710 e_info_server_protocol_trace_path_init(char *trace_path)
7712 if (!trace_path || strlen(trace_path) <= 0)
7715 INF("%s: trace_path : %s\n", __func__, trace_path);
7717 log_fp_ptrace = fopen(trace_path, "a");
7721 ERR("failed: open file(%s)\n", trace_path);
7725 setvbuf(log_fp_ptrace, NULL, _IOLBF, 512);
7726 if (e_info_protocol_logger)
7728 wl_protocol_logger_destroy(e_info_protocol_logger);
7729 e_info_protocol_logger = NULL;
7732 e_info_protocol_logger = wl_display_add_protocol_logger(e_comp->wl_comp_data->wl.disp, _e_info_server_protocol_debug_func2, NULL);
7738 _e_info_server_dbus_init(void *data EINA_UNUSED)
7742 e_info_server.iface = eldbus_service_interface_register(e_info_server.edbus_conn,
7745 EINA_SAFETY_ON_NULL_GOTO(e_info_server.iface, err);
7747 E_EVENT_INFO_ROTATION_MESSAGE = ecore_event_type_new();
7749 e_info_protocol_init();
7751 s = e_util_env_get("E_INFO_RULE_FILE");
7752 e_info_server_protocol_rule_path_init(s);
7755 s = e_util_env_get("E_INFO_TRACE_FILE");
7756 e_info_server_protocol_trace_path_init(s);
7759 e_main_hook_call(E_MAIN_HOOK_E_INFO_READY);
7761 return ECORE_CALLBACK_CANCEL;
7764 e_info_server_shutdown();
7766 return ECORE_CALLBACK_CANCEL;
7770 _e_info_server_cb_dbus_init_done(void *data, int type, void *event)
7772 E_DBus_Conn_Init_Done_Event *e = event;
7774 if (e->status == E_DBUS_CONN_INIT_SUCCESS && e->conn_type == e_info_server.edbus_conn_type)
7776 e_info_server.edbus_conn = e_dbus_conn_connection_ref(e_info_server.edbus_conn_type);
7778 if (e_info_server.edbus_conn)
7779 _e_info_server_dbus_init(NULL);
7782 ecore_event_handler_del(e_info_server.dbus_init_done_handler);
7783 e_info_server.dbus_init_done_handler = NULL;
7785 return ECORE_CALLBACK_PASS_ON;
7790 e_info_server_init(void)
7793 s = e_util_env_get("MALLOC_TRACE");
7798 e_util_env_set("MALLOC_TRACE", "/tmp/e20_mtrace");
7800 e_info_server.edbus_conn = NULL;
7801 e_info_server.edbus_conn_type = ELDBUS_CONNECTION_TYPE_SYSTEM;
7802 e_info_server.dbus_init_done_handler = NULL;
7804 if (e_dbus_conn_init() > 0)
7806 e_info_server.dbus_init_done_handler = ecore_event_handler_add(E_EVENT_DBUS_CONN_INIT_DONE, _e_info_server_cb_dbus_init_done, NULL);
7807 e_dbus_conn_dbus_init(e_info_server.edbus_conn_type);
7814 e_info_server_shutdown(void)
7816 if (e_info_server.dbus_init_done_handler)
7818 ecore_event_handler_del(e_info_server.dbus_init_done_handler);
7819 e_info_server.dbus_init_done_handler = NULL;
7822 if (e_info_server.iface)
7824 eldbus_service_interface_unregister(e_info_server.iface);
7825 e_info_server.iface = NULL;
7828 if (e_info_server.edbus_conn)
7830 eldbus_name_release(e_info_server.edbus_conn, BUS, NULL, NULL);
7831 e_dbus_conn_connection_unref(e_info_server.edbus_conn);
7832 e_info_server.edbus_conn = NULL;
7835 e_dbus_conn_shutdown();
7837 if (e_info_transform_list)
7839 E_Info_Transform *info;
7840 Eina_List *l, *l_next;
7842 EINA_LIST_FOREACH_SAFE(e_info_transform_list, l, l_next, info)
7844 _e_info_transform_del(info);
7847 eina_list_free(e_info_transform_list);
7848 e_info_transform_list = NULL;
7851 if (e_info_dump_running == 1)
7853 tdm_helper_dump_stop();
7854 tbm_surface_internal_dump_end();
7856 if (e_info_dump_hdlrs)
7858 E_FREE_LIST(e_info_dump_hdlrs, ecore_event_handler_del);
7859 e_info_dump_hdlrs = NULL;
7861 if (e_info_dump_path)
7863 free(e_info_dump_path);
7864 e_info_dump_path = NULL;
7866 e_info_dump_count = 0;
7867 e_info_dump_running = 0;
7869 if (module_hook) _e_info_server_module_hook_cleanup();
7871 e_info_protocol_shutdown();
7877 e_info_server_dump_client(E_Client *ec, char *fname)
7881 Ecore_Evas *ee = NULL;
7882 Evas_Object *img = NULL;
7886 if (e_client_util_ignored_get(ec)) return;
7888 struct wl_shm_buffer *shmbuffer = NULL;
7889 E_Comp_Wl_Buffer *buffer = e_pixmap_resource_get(ec->pixmap);
7890 if (!buffer) return;
7892 if (buffer->type == E_COMP_WL_BUFFER_TYPE_SHM)
7894 shmbuffer = wl_shm_buffer_get(buffer->resource);
7897 data = wl_shm_buffer_get_data(shmbuffer);
7898 w = wl_shm_buffer_get_stride(shmbuffer) / 4;
7899 h = wl_shm_buffer_get_height(shmbuffer);
7902 else if (buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE)
7904 tbm_surface_info_s surface_info;
7905 tbm_surface_h tbm_surface = wayland_tbm_server_get_surface(NULL, buffer->resource);
7907 EINA_SAFETY_ON_NULL_RETURN(tbm_surface);
7908 memset(&surface_info, 0, sizeof(tbm_surface_info_s));
7909 res = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &surface_info);
7910 if (res != TBM_SURFACE_ERROR_NONE)
7913 data = surface_info.planes[0].ptr;
7914 w = surface_info.planes[0].stride / 4;
7915 h = surface_info.height;
7917 else if (buffer->type == E_COMP_WL_BUFFER_TYPE_TBM)
7919 tbm_surface_info_s surface_info;
7920 tbm_surface_h tbm_surface = buffer->tbm_surface;
7922 EINA_SAFETY_ON_NULL_RETURN(tbm_surface);
7923 memset(&surface_info, 0, sizeof(tbm_surface_info_s));
7924 res = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &surface_info);
7925 if (res != TBM_SURFACE_ERROR_NONE)
7928 data = surface_info.planes[0].ptr;
7929 w = surface_info.planes[0].stride / 4;
7930 h = surface_info.height;
7934 ERR("Invalid resource:%u", wl_resource_get_id(buffer->resource));
7937 EINA_SAFETY_ON_NULL_GOTO(data, err);
7939 ee = ecore_evas_buffer_new(1, 1);
7940 EINA_SAFETY_ON_NULL_GOTO(ee, err);
7942 img = evas_object_image_add(ecore_evas_get(ee));
7943 EINA_SAFETY_ON_NULL_GOTO(img, err);
7945 evas_object_image_alpha_set(img, EINA_TRUE);
7946 evas_object_image_size_set(img, w, h);
7947 evas_object_image_data_set(img, data);
7949 if (!evas_object_image_save(img, fname, NULL, "compress=1 quality=100"))
7950 ERR("Cannot save window to '%s'", fname);
7955 if (buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE)
7957 tbm_surface_h tbm_surface = wayland_tbm_server_get_surface(NULL, buffer->resource);
7958 tbm_surface_unmap(tbm_surface);
7960 else if (buffer->type == E_COMP_WL_BUFFER_TYPE_TBM)
7962 tbm_surface_h tbm_surface = buffer->tbm_surface;
7963 tbm_surface_unmap(tbm_surface);
7967 if (img) evas_object_del(img);
7968 if (ee) ecore_evas_free(ee);
7972 static E_Info_Transform*
7973 _e_info_transform_new(E_Client *ec, int id, int enable, int x, int y, int sx, int sy, int degree, int background, const char *role)
7975 E_Info_Transform *result = NULL;
7976 result = _e_info_transform_find(ec, id);
7980 result = (E_Info_Transform*)malloc(sizeof(E_Info_Transform));
7981 EINA_SAFETY_ON_NULL_RETURN_VAL(result, NULL);
7982 memset(result, 0, sizeof(E_Info_Transform));
7985 result->transform = e_util_transform_new();
7986 e_util_transform_role_set(result->transform, role);
7987 result->background = background;
7989 _e_info_transform_set(result, enable, x, y, sx, sy, degree);
7990 e_info_transform_list = eina_list_append(e_info_transform_list, result);
7996 static E_Info_Transform*
7997 _e_info_transform_find(E_Client *ec, int id)
8000 E_Info_Transform *transform;
8001 E_Info_Transform *result = NULL;
8003 EINA_LIST_FOREACH(e_info_transform_list, l, transform)
8005 if (transform->ec == ec && transform->id == id)
8016 _e_info_transform_set(E_Info_Transform *transform, int enable, int x, int y, int sx, int sy, int degree)
8018 if (!transform) return;
8019 if (!transform->transform) return;
8021 if (transform->background)
8023 e_util_transform_bg_move(transform->transform, (double)x, (double)y, 0.0);
8024 e_util_transform_bg_scale(transform->transform, (double)sx / 100.0, (double)sy / 100.0, 1.0);
8025 e_util_transform_bg_rotation(transform->transform, 0.0, 0.0, degree);
8029 e_util_transform_move(transform->transform, (double)x, (double)y, 0.0);
8030 e_util_transform_scale(transform->transform, (double)sx / 100.0, (double)sy / 100.0, 1.0);
8031 e_util_transform_rotation(transform->transform, 0.0, 0.0, degree);
8034 if (enable != transform->enable)
8037 e_client_transform_core_add(transform->ec, transform->transform);
8039 e_client_transform_core_remove(transform->ec, transform->transform);
8041 transform->enable = enable;
8044 e_client_transform_core_update(transform->ec);
8048 _e_info_transform_del(E_Info_Transform *transform)
8050 if (!transform) return;
8052 e_info_transform_list = eina_list_remove(e_info_transform_list, transform);
8054 if (transform->enable)
8056 e_client_transform_core_remove(transform->ec, transform->transform);
8059 e_util_transform_del(transform->transform);
8064 _e_info_transform_del_with_id(E_Client *ec, int id)
8066 E_Info_Transform *transform = NULL;
8069 transform = _e_info_transform_find(ec, id);
8072 _e_info_transform_del(transform);