2 #include "e_info_shared_types.h"
3 #include "e_info_client_screen_recorder.h"
8 typedef void (*E_Info_Message_Cb)(const Eldbus_Message *msg);
10 typedef struct _E_Info_Client
15 Eldbus_Connection *conn;
19 int use_gl, use_hwc, use_multi_layer, hwc, hwc_windows;
20 int use_buffer_flush, deiconify_approve;
30 Eina_List *pending_commit_list;
36 const char *dump_fullpath;
37 Eina_Bool dump_success;
42 typedef struct _E_Zone_Info
52 typedef struct _E_Win_Info
54 Ecore_Window id; // native window id
57 const char *name; // name of client window
58 int x, y, w, h; // geometry
59 int layer; // value of E_Layer
60 int vis; // ec->visible
61 int mapped; // map state (ec->comp_data->mapped)
62 int alpha; // alpha window
64 int visibility; // visibillity
65 Eina_Bool force_obscured;
67 int frame_visible; //ec->frame obj visible get
69 int hwc; // hwc enable/disable
70 int hwc_policy; // hwc policy
71 int pl_zpos; // hwc value : (hwc_windows: hwc window state) (hwc_planes: zpos of the plane)
72 Ecore_Window parent_id;
73 const char *layer_name; // layer name
74 Eina_Bool has_input_region;
75 Eina_Bool transformed;
76 E_Transient transient_policy;
78 Eina_Bool is_apply_layout;
81 typedef struct output_mode_info
83 unsigned int hdisplay, hsync_start, hsync_end, htotal;
84 unsigned int vdisplay, vsync_start, vsync_end, vtotal;
85 unsigned int refresh, vscan, clock;
87 int current, output, connect, dpms;
91 typedef struct _E_Pending_Commit_Info
96 unsigned int tsurface;
97 } E_Pending_Commit_Info;
99 typedef struct _E_Fps_Info
101 E_Info_Fps_Type type;
108 #define VALUE_TYPE_FOR_ZONE "iiiiiibii"
109 #define VALUE_TYPE_FOR_TOPVWINS "uuisiiiiibbbiibibbiiiusbbiib"
110 #define VALUE_TYPE_REQUEST_RESLIST "ui"
111 #define VALUE_TYPE_REPLY_RESLIST "ssu"
112 #define VALUE_TYPE_FOR_INPUTDEV "ssiss"
113 #define VALUE_TYPE_FOR_PENDING_COMMIT "uiuu"
114 #define VALUE_TYPE_FOR_FPS "usiud"
115 #define VALUE_TYPE_REQUEST_FOR_KILL "uts"
116 #define VALUE_TYPE_REPLY_KILL "s"
117 #define VALUE_TYPE_REQUEST_FOR_WININFO "t"
118 #define VALUE_TYPE_REPLY_WININFO "uiiiiiibbiibbbiitsiiib"
119 #define VALUE_TYPE_REQUEST_FOR_WININFO_TREE "ti"
120 #define VALUE_TYPE_REPLY_WININFO_TREE "tsia(tsiiiiiiii)"
122 static E_Info_Client e_info_client;
124 static Eina_Bool compobjs_simple = EINA_FALSE;
126 static void end_program(int sig);
127 static Eina_Bool _e_info_client_eldbus_message(const char *method, E_Info_Message_Cb cb);
128 static Eina_Bool _e_info_client_eldbus_message_with_args(const char *method, E_Info_Message_Cb cb, const char *signature, ...);
129 static Eina_Bool _e_info_client_eldbus_message_with_args_timeout(const char *method, E_Info_Message_Cb cb, double timeout, const char *signature, ...);
130 static void _e_info_client_eldbus_message_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
133 _util_string_to_uint(const char *str, unsigned int *num, int base)
138 EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
139 EINA_SAFETY_ON_NULL_RETURN_VAL(num, EINA_FALSE);
141 const unsigned long int ul = strtoul(str, &end, base);
144 EINA_SAFETY_ON_TRUE_RETURN_VAL((end == str), EINA_FALSE); /* given string is not a decimal number */
145 EINA_SAFETY_ON_TRUE_RETURN_VAL(('\0' != *end), EINA_FALSE); /* given string has extra characters */
146 EINA_SAFETY_ON_TRUE_RETURN_VAL(((ULONG_MAX == ul) && (ERANGE == errsv)), EINA_FALSE); /* out of range of type unsigned long int */
148 *num = (unsigned int)ul;
153 /* buff: string to be parsed
154 * next: return values it contains the address of the first invalid character
155 * num: return value it contains integer value according to the given base
158 _util_string_to_int_token(const char *str, char **next, int *num, int base)
162 EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
163 EINA_SAFETY_ON_NULL_RETURN_VAL(next, EINA_FALSE);
164 EINA_SAFETY_ON_NULL_RETURN_VAL(num, EINA_FALSE);
166 const long int sl = strtol(str, next, base);
169 EINA_SAFETY_ON_TRUE_RETURN_VAL((*next == str), EINA_FALSE); /* given string is not a decimal number */
170 EINA_SAFETY_ON_TRUE_RETURN_VAL(((LONG_MIN == sl || LONG_MAX == sl) && (ERANGE == errsv)), EINA_FALSE); /* out of range of type long */
171 EINA_SAFETY_ON_TRUE_RETURN_VAL((sl > INT_MAX), EINA_FALSE); /* greater than INT_MAX */
172 EINA_SAFETY_ON_TRUE_RETURN_VAL((sl < INT_MIN), EINA_FALSE); /* less than INT_MIN */
180 _util_string_to_double(const char *str, double *num)
185 EINA_SAFETY_ON_FALSE_RETURN_VAL(str, EINA_FALSE);
186 EINA_SAFETY_ON_FALSE_RETURN_VAL(num, EINA_FALSE);
188 const double sd = strtod(str, &end);
191 EINA_SAFETY_ON_TRUE_RETURN_VAL((end == str), EINA_FALSE); /* given string is not a floating point number */
192 EINA_SAFETY_ON_TRUE_RETURN_VAL(('\0' != *end), EINA_FALSE); /* given string has extra characters */
193 EINA_SAFETY_ON_TRUE_RETURN_VAL(((DBL_MIN == sd || DBL_MAX == sd) && (ERANGE == errsv)), EINA_FALSE); /* out of range of type double */
201 _util_string_to_ulong(const char *str, unsigned long *num, int base)
206 EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
207 EINA_SAFETY_ON_NULL_RETURN_VAL(num, EINA_FALSE);
209 const unsigned long sul = strtoul(str, &end, base);
212 EINA_SAFETY_ON_TRUE_RETURN_VAL((end == str), EINA_FALSE); /* given string is not a decimal number */
213 EINA_SAFETY_ON_TRUE_RETURN_VAL(('\0' != *end), EINA_FALSE); /* given string has extra characters */
214 EINA_SAFETY_ON_TRUE_RETURN_VAL(((ULONG_MAX == sul) && (ERANGE == errsv)), EINA_FALSE); /* out of range of type unsigned long */
222 _e_signal_get_window_under_touch(void *data, const Eldbus_Message *msg)
226 Ecore_Window *win = data;
228 res = eldbus_message_arguments_get(msg, "t", &w);
229 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
231 *win = (Ecore_Window)w;
234 ecore_main_loop_quit();
238 _e_message_get_window_under_touch(const Eldbus_Message *msg)
240 const char *name = NULL, *text = NULL;
244 res = eldbus_message_error_get(msg, &name, &text);
245 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
247 res = eldbus_message_arguments_get(msg, "i", &result);
248 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
249 EINA_SAFETY_ON_TRUE_GOTO(result, finish);
254 if ((name) || (text))
256 printf("errname:%s errmsg:%s\n", name, text);
259 ecore_main_loop_quit();
263 _e_get_window_under_touch(Ecore_Window *win)
266 Eldbus_Signal_Handler *signal_handler = NULL;
270 signal_handler = eldbus_proxy_signal_handler_add(e_info_client.proxy, "win_under_touch", _e_signal_get_window_under_touch, win);
271 EINA_SAFETY_ON_NULL_GOTO(signal_handler, fail);
273 res = _e_info_client_eldbus_message("get_win_under_touch",
274 _e_message_get_window_under_touch);
275 EINA_SAFETY_ON_FALSE_GOTO(res, fail);
277 ecore_main_loop_begin();
279 eldbus_signal_handler_del(signal_handler);
285 eldbus_signal_handler_del(signal_handler);
291 _e_message_get_window_name(void *data, const Eldbus_Message *msg, Eldbus_Pending *p EINA_UNUSED)
295 const char *name = NULL, *text = NULL;
299 res = eldbus_message_error_get(msg, &name, &text);
300 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
302 res = eldbus_message_arguments_get(msg, "s", &w);
303 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
304 EINA_SAFETY_ON_NULL_GOTO(w, finish);
308 ecore_main_loop_quit();
313 if ((name) || (text))
315 printf("errname:%s errmsg:%s\n", name, text);
318 ecore_main_loop_quit();
322 _e_get_window_name(uint64_t win)
325 char *win_name = NULL;
327 p = eldbus_proxy_call(e_info_client.proxy, "get_window_name",
328 _e_message_get_window_name,
329 &win_name, -1, "t", win);
330 EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
332 ecore_main_loop_begin();
338 _e_message_get_windows(void *data, const Eldbus_Message *msg, Eldbus_Pending *p EINA_UNUSED)
340 const char *name = NULL, *text = NULL;
342 Eldbus_Message_Iter *array_of_windows;
344 Eina_List **win_list = data;
346 res = eldbus_message_error_get(msg, &name, &text);
347 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
349 res = eldbus_message_arguments_get(msg, "at", &array_of_windows);
350 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
352 while (eldbus_message_iter_get_and_next(array_of_windows, 't', &win))
354 *win_list = eina_list_append(*win_list, (void *)((Ecore_Window)win));
357 ecore_main_loop_quit();
362 if ((name) || (text))
364 printf("errname:%s errmsg:%s\n", name, text);
367 ecore_main_loop_quit();
370 const static int _E_GET_WINDOWS_NAME_MODE = 1;
371 const static int _E_GET_WINDOWS_PID_MODE = 2;
374 _e_get_windows(int mode, char *value)
377 Eina_List *win_list = NULL;
379 p = eldbus_proxy_call(e_info_client.proxy, "get_windows",
380 _e_message_get_windows,
381 &win_list, -1, "is", mode, value);
382 EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
384 ecore_main_loop_begin();
390 _e_zone_info_new(int id, int display_state, int x, int y, int w, int h, Eina_Bool is_current, int angle_cur, int angle_active)
392 E_Zone_Info *zone_info = NULL;
394 zone_info = E_NEW(E_Zone_Info, 1);
395 if (!zone_info) return NULL;
398 zone_info->display_state = display_state;
403 zone_info->is_current = is_current;
404 zone_info->angle_cur = angle_cur;
405 zone_info->angle_active = angle_active;
411 _e_zone_info_make_array(Eldbus_Message_Iter *zone_array)
413 Eldbus_Message_Iter *zone;
416 while (eldbus_message_iter_get_and_next(zone_array, 'r', &zone))
418 E_Zone_Info *zone_info = NULL;
422 Eina_Bool is_current;
426 res = eldbus_message_iter_arguments_get(zone, VALUE_TYPE_FOR_ZONE, &id, &display_state, &x, &y, &w, &h, &is_current, &angle_cur, &angle_active);
429 printf("Failed to get win info\n");
433 zone_info = _e_zone_info_new(id, display_state, x, y, w, h, is_current, angle_cur, angle_active);
434 e_info_client.zone_list = eina_list_append(e_info_client.zone_list, zone_info);
440 _e_win_info_new(Ecore_Window id, uint32_t res_id, int pid, Eina_Bool alpha, int opaque, const char *name,
441 int x, int y, int w, int h, int layer, int visible, int mapped, int visibility, Eina_Bool force_obscured,
442 int iconic, int frame_visible, int focused, int hwc, int hwc_policy, int pl_zpos, Ecore_Window parent_id,
443 const char *layer_name, Eina_Bool has_input_region, Eina_Bool transformed, E_Transient transient_policy, int zone_id, Eina_Bool is_apply_layout)
445 E_Win_Info *win = NULL;
447 win = E_NEW(E_Win_Info, 1);
448 EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
451 win->res_id = res_id;
453 win->name = eina_stringshare_add(name);
460 win->opaque = opaque;
462 win->mapped = mapped;
463 win->visibility = visibility;
464 win->force_obscured = force_obscured;
465 win->frame_visible = frame_visible;
466 win->iconic = iconic;
467 win->focused = focused;
469 win->hwc_policy = hwc_policy;
470 win->pl_zpos = pl_zpos;
471 win->parent_id = parent_id;
472 win->layer_name = eina_stringshare_add(layer_name);
473 win->has_input_region = has_input_region;
474 win->transformed = transformed;
475 win->transient_policy = transient_policy;
476 win->zone_id = zone_id;
477 win->is_apply_layout = is_apply_layout;
483 _e_win_info_free(E_Win_Info *win)
485 EINA_SAFETY_ON_NULL_RETURN(win);
488 eina_stringshare_del(win->name);
491 eina_stringshare_del(win->layer_name);
497 _e_win_info_make_array(Eldbus_Message_Iter *array)
499 Eldbus_Message_Iter *ec;
502 while (eldbus_message_iter_get_and_next(array, 'r', &ec))
504 const char *win_name;
505 const char *layer_name;
506 int x, y, w, h, layer, visibility, opaque, hwc, hwc_policy, pl_zpos, iconic;
507 Eina_Bool visible, mapped, alpha, force_obscured, focused, frame_visible, transformed;
508 Ecore_Window id, parent_id;
511 E_Win_Info *win = NULL;
512 Eina_Bool has_input_region = EINA_FALSE;
513 int transient_policy;
515 Eina_Bool is_apply_layout;
516 res = eldbus_message_iter_arguments_get(ec,
517 VALUE_TYPE_FOR_TOPVWINS,
548 printf("Failed to get win info\n");
552 win = _e_win_info_new(id, res_id, pid, alpha, opaque, win_name, x, y, w, h,
553 layer, visible, mapped, visibility, force_obscured, iconic, frame_visible,
554 focused, hwc, hwc_policy, pl_zpos, parent_id, layer_name,
555 has_input_region, transformed, (E_Transient)transient_policy, zone_id, is_apply_layout);
556 e_info_client.win_list = eina_list_append(e_info_client.win_list, win);
561 _cb_window_info_get(const Eldbus_Message *msg)
563 const char *name = NULL, *text = NULL;
564 Eldbus_Message_Iter *array;
567 res = eldbus_message_error_get(msg, &name, &text);
568 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
570 res = eldbus_message_arguments_get(msg, "iia("VALUE_TYPE_FOR_TOPVWINS")", &e_info_client.hwc, &e_info_client.hwc_windows, &array);
571 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
573 _e_win_info_make_array(array);
576 if ((name) || (text))
578 printf("errname:%s errmsg:%s\n", name, text);
583 _cb_zone_info_get(const Eldbus_Message *msg)
585 const char *name = NULL, *text = NULL;
586 Eldbus_Message_Iter *zone_array;
587 Eina_Bool res = EINA_FALSE;
589 res = eldbus_message_error_get(msg, &name, &text);
590 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
592 res = eldbus_message_arguments_get(msg, "("VALUE_TYPE_FOR_ZONE")", &zone_array);
593 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
595 _e_zone_info_make_array(zone_array);
597 if ((name) || (text) || (!res))
599 printf("errname:%s errmsg:%s ret:%d\n", name, text, res);
604 _cb_vwindow_info_get(const Eldbus_Message *msg)
606 const char *name = NULL, *text = NULL;
607 Eldbus_Message_Iter *array;
611 res = eldbus_message_error_get(msg, &name, &text);
612 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
614 res = eldbus_message_arguments_get(msg, "iiiiisiiia("VALUE_TYPE_FOR_TOPVWINS")",
615 &e_info_client.use_gl, &e_info_client.use_hwc, &e_info_client.use_multi_layer,
616 &e_info_client.hwc, &e_info_client.hwc_windows,
617 &engine, &e_info_client.config_engine,
618 &e_info_client.use_buffer_flush, &e_info_client.deiconify_approve,
621 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
622 e_info_client.engine = eina_stringshare_add(engine);
624 _e_win_info_make_array(array);
627 if ((name) || (text))
629 printf("errname:%s errmsg:%s\n", name, text);
635 _e_info_client_cb_compobjs(const Eldbus_Message *msg)
637 const char *name = NULL, *text = NULL, *obj_name;
638 Eldbus_Message_Iter *array, *obj;
640 E_Info_Comp_Obj cobj;
643 res = eldbus_message_error_get(msg, &name, &text);
644 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
646 res = eldbus_message_arguments_get(msg,
647 "a("SIGNATURE_COMPOBJS_CLIENT")",
649 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
653 "===========================================================================================================================\n"
654 " /-- Object Type /-- Alpha \n"
655 " | r : Rectangle | /-- Edj: group \n"
656 " | EDJ: Edje | /-- Pass Events | Edj Member: part, value \n"
657 " | IMG: Image | |/-- Freeze Events | Native Image: \n"
658 " | EC : ec->frame | ||/-- Focused | type, buff, size, load, fill\n"
659 " | | |||/-- EvasMap | size size\n"
660 " | | |||| | File Image: \n"
661 " | | |||| /-- Visibility | data, size, load, fill \n"
662 " | | |||| | | size size \n"
664 "========================|======================|=||||=|===================================|================================\n"
665 "Layer ObjectID | X Y W H | |||| | ObjectName | Additional Info \n"
666 "========================|======================|=||||=|===================================|================================\n"
670 "=======================================================================================================================\n"
671 " /-- Object Type /-- Alpha \n"
672 " | r : Rectangle Object | \n"
673 " | EDJ: Edje Object | /-- Pass Events \n"
674 " | IMG: Image Object | |/-- Freeze Events \n"
675 " | EC : ec->frame Object | ||/-- Focused \n"
676 " | | |||/- EvasMap \n"
678 " | /-- Render Operation | |||| /-- Visibility \n"
679 " | | BL: EVAS_RENDER_BLEND | |||| | \n"
680 " | | CP: EVAS_RENDER_COPY | |||| | \n"
681 " | | | |||| | [Additional Info]\n"
682 " | | | |||| | EDJ: group, file |\n"
683 " | | | |||| | EDJ member: part, value |\n"
684 " | | | |||| | Image: Type, Size, Load Size, Fill Size |\n"
685 " | | | |||| | Map: Enable, Alpha, UV, Coord |\n"
687 "========================|====|=====================================|=||||=|============================================\n"
688 "Layer ObjectID | | X Y W H Color(RGBA) | |||| | ObjectName |\n"
689 "========================|====|=====================================|=||||=|============================================\n"
692 while (eldbus_message_iter_get_and_next(array, 'r', &obj))
694 memset(&cobj, 0, sizeof(E_Info_Comp_Obj));
696 res = eldbus_message_iter_arguments_get(obj,
697 SIGNATURE_COMPOBJS_CLIENT,
704 &cobj.x, &cobj.y, &cobj.w, &cobj.h,
705 &cobj.r, &cobj.g, &cobj.b, &cobj.a,
715 &cobj.img.native_type,
719 &cobj.img.w, &cobj.img.h,
720 &cobj.img.lw, &cobj.img.lh,
721 &cobj.img.fx, &cobj.img.fy, &cobj.img.fw, &cobj.img.fh,
726 &cobj.map.u[0], &cobj.map.u[1], &cobj.map.u[2], &cobj.map.u[3],
727 &cobj.map.v[0], &cobj.map.v[1], &cobj.map.v[2], &cobj.map.v[3],
728 &cobj.map.x[0], &cobj.map.x[1], &cobj.map.x[2], &cobj.map.x[3],
729 &cobj.map.y[0], &cobj.map.y[1], &cobj.map.y[2], &cobj.map.y[3],
730 &cobj.map.z[0], &cobj.map.z[1], &cobj.map.z[2], &cobj.map.z[3]);
733 printf("Failed to get composite obj info\n");
739 if (!compobjs_simple)
740 printf(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - |\n");
741 printf("%4d ", cobj.ly);
746 for (i = 0; i < cobj.depth; i++) printf(" ");
747 printf("%08x ", cobj.obj);
748 for (i = 6; i > cobj.depth; i--) printf(" ");
752 "|%4d,%4d %4dx%4d|%s|%s%s%s%s|%s|",
754 cobj.x, cobj.y, cobj.w, cobj.h,
755 cobj.img.alpha == 1 ? "A" : " ",
756 cobj.pass_events == 1 ? "p" : " ",
757 cobj.freeze_events == 1 ? "z" : " ",
758 cobj.focus == 1 ? "F" : " ",
759 cobj.map.enable == 1 ? "M" : " ",
760 cobj.vis == 1 ? "V" : " ");
764 "|%4d,%4d %4dx%4d|%3d %3d %3d %3d|%s|%s%s%s%s|%s|",
767 cobj.x, cobj.y, cobj.w, cobj.h,
768 cobj.r, cobj.g, cobj.b, cobj.a,
769 cobj.img.alpha == 1 ? "A" : " ",
770 cobj.pass_events == 1 ? "p" : " ",
771 cobj.freeze_events == 1 ? "z" : " ",
772 cobj.focus == 1 ? "F" : " ",
773 cobj.map.enable == 1 ? "M" : " ",
774 cobj.vis == 1 ? "V" : " ");
776 obj_name = cobj.name;
777 if (!strncmp(obj_name, "no_use", 6)) obj_name = "";
778 printf("%-32.32s|", obj_name);
780 if (!strncmp(cobj.type, "EDJ", 3))
782 if (strncmp(cobj.edje.group, "no_use", 6)) printf("%s ", cobj.edje.group);
784 if (!compobjs_simple)
785 if (strncmp(cobj.edje.file, "no_use", 6)) printf("%s ", cobj.edje.file);
788 if (strncmp(cobj.edje.part, "no_use", 6)) printf("%s %1.1f", cobj.edje.part, cobj.edje.val);
790 if (!strncmp(cobj.type, "IMG", 3))
794 if (strncmp(cobj.img.native_type, "no_use", 6)) printf("%s ", cobj.img.native_type);
798 if (!compobjs_simple)
799 if (strncmp(cobj.img.file, "no_use", 6)) printf("%s ", cobj.img.file);
801 if (strncmp(cobj.img.key, "no_use", 6)) printf("%s ", cobj.img.key);
805 printf("d:%x %dx%d %dx%d (%d,%d %dx%d)",
807 cobj.img.w, cobj.img.h,
808 cobj.img.lw, cobj.img.lh,
809 cobj.img.fx, cobj.img.fy, cobj.img.fw, cobj.img.fh);
813 if (!compobjs_simple && cobj.map.enable)
816 printf("|Map: %s\n", (cobj.map.alpha == 1) ? "alpha(on)" : "alpha(off)");
818 printf("| UV ( %4d,%4d | %4d,%4d | %4d,%4d | %4d,%4d )\n",
819 (int)cobj.map.u[0], (int)cobj.map.v[0],
820 (int)cobj.map.u[1], (int)cobj.map.v[1],
821 (int)cobj.map.u[2], (int)cobj.map.v[2],
822 (int)cobj.map.u[3], (int)cobj.map.v[3]);
824 printf("| Coord (%4d,%4d,%4d|%4d,%4d,%4d|%4d,%4d,%4d|%4d,%4d,%4d)\n",
825 cobj.map.x[0], cobj.map.y[0], cobj.map.z[0],
826 cobj.map.x[1], cobj.map.y[1], cobj.map.z[1],
827 cobj.map.x[2], cobj.map.y[2], cobj.map.z[2],
828 cobj.map.x[3], cobj.map.y[3], cobj.map.z[3]);
833 printf("===========================================================================================================================\n");
835 printf("=======================================================================================================================\n");
838 if ((name) || (text))
840 printf("errname:%s errmsg:%s\n", name, text);
845 _cb_input_device_info_get(const Eldbus_Message *msg)
847 const char *name = NULL, *text = NULL;
848 Eldbus_Message_Iter *array, *eldbus_msg;
852 res = eldbus_message_error_get(msg, &name, &text);
853 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
855 res = eldbus_message_arguments_get(msg, "a("VALUE_TYPE_FOR_INPUTDEV")", &array);
856 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
858 printf("--------------------------------------[ input devices ]----------------------------------------------------------\n");
859 printf(" No Name identifier Cap Seat Output\n");
860 printf("-----------------------------------------------------------------------------------------------------------------\n");
862 while (eldbus_message_iter_get_and_next(array, 'r', &eldbus_msg))
870 res = eldbus_message_iter_arguments_get(eldbus_msg,
871 VALUE_TYPE_FOR_INPUTDEV,
879 printf("Failed to get device info\n");
883 printf("%3d %30s %20s ", i, dev_name, identifier);
884 if (clas == ECORE_DEVICE_CLASS_MOUSE) printf("Mouse | ");
885 else if (clas == ECORE_DEVICE_CLASS_KEYBOARD) printf("Keyboard | ");
886 else if (clas == ECORE_DEVICE_CLASS_TOUCH) printf("Touch | ");
887 else if (clas == ECORE_DEVICE_CLASS_SEAT) printf("Seat | ");
888 printf("(0x%x) ", clas);
889 printf("%10s", seat_name);
890 printf("%15s\n", output_name);
895 printf("no input devices\n");
900 if ((name) || (text))
902 printf("errname:%s errmsg:%s\n", name, text);
907 _cb_input_keymap_info_get(const Eldbus_Message *msg)
909 const char *name = NULL, *text = NULL;
912 int min_keycode=0, max_keycode=0, fd=0, size=0, num_mods=0, num_groups = 0;
913 struct xkb_context *context = NULL;
914 struct xkb_keymap *keymap = NULL;
915 struct xkb_state *state = NULL;
916 xkb_keysym_t sym = XKB_KEY_NoSymbol;
917 char keyname[256] = {0, };
920 res = eldbus_message_error_get(msg, &name, &text);
921 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
923 res = eldbus_message_arguments_get(msg, "hi", &fd, &size);
924 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
926 context = xkb_context_new(0);
927 EINA_SAFETY_ON_NULL_GOTO(context, finish);
929 map = mmap(NULL, size, 0x01, 0x0001, fd, 0);
930 if (map == ((void *)-1))
932 xkb_context_unref(context);
937 keymap = xkb_map_new_from_string(context, map, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
942 EINA_SAFETY_ON_NULL_GOTO(keymap, finish);
943 state = xkb_state_new(keymap);
944 EINA_SAFETY_ON_NULL_GOTO(state, finish);
946 min_keycode = xkb_keymap_min_keycode(keymap);
947 max_keycode = xkb_keymap_max_keycode(keymap);
948 num_groups = xkb_map_num_groups(keymap);
949 num_mods = xkb_keymap_num_mods(keymap);
952 printf(" min keycode: %d\n", min_keycode);
953 printf(" max keycode: %d\n", max_keycode);
954 printf(" num_groups : %d\n", num_groups);
955 printf(" num_mods : %d\n", num_mods);
956 for (i = 0; i < num_mods; i++)
958 printf(" [%2d] mod: %s\n", i, xkb_keymap_mod_get_name(keymap, i));
961 printf("\n\n\tkeycode\t\tkeyname\t\t keysym\t repeat\n");
962 printf(" ----------------------------------------------------------------------\n");
964 for (i = min_keycode; i < (max_keycode + 1); i++)
966 sym = xkb_state_key_get_one_sym(state, i);
968 memset(keyname, 0, sizeof(keyname));
969 xkb_keysym_get_name(sym, keyname, sizeof(keyname));
971 printf("\t%4d%-5s%-25s%-20x%-5d\n", i, "", keyname, sym, xkb_keymap_key_repeats(keymap, i));
974 if ((name) || (text ))
976 printf("errname:%s errmsg:%s\n", name, text);
978 if (state) xkb_state_unref(state);
979 if (keymap) xkb_map_unref(keymap);
980 if (context) xkb_context_unref(context);
983 #define PROTOCOL_RULE_USAGE \
984 "[COMMAND] [ARG]...\n" \
985 "\tadd : add the rule to trace events (Usage: add [allow|deny] [RULE(iface=wl_touch and msg=down)]\n" \
986 "\tremove : remove the rule (Usage: remove [all|RULE_INDEX])\n" \
987 "\tfile : add rules from file (Usage: file [RULE_FILE_PATH])\n" \
988 "\tprint : print current rules\n" \
992 _e_info_client_proc_protocol_trace(int argc, char **argv)
994 char fd_name[PATH_MAX + PATH_MAX];
998 if (argc != 3 || !argv[2])
1000 printf("protocol-trace: Usage> enlightenment_info -protocol_trace [console | file path | disable]\n");
1007 if (!getcwd(cwd, sizeof(cwd)))
1008 snprintf(cwd, sizeof(cwd), "/tmp");
1010 if (!strncmp(argv[2], "console", 7))
1011 snprintf(fd_name, sizeof(fd_name), "/proc/%d/fd/1", pid);
1012 else if (!strncmp(argv[2], "elog", 4))
1013 snprintf(fd_name, sizeof(fd_name), "elog");
1014 else if (!strncmp(argv[2], "disable", 7))
1015 snprintf(fd_name, sizeof(fd_name), "disable");
1018 if (argv[2][0] == '/')
1019 snprintf(fd_name, PATH_MAX, "%s", argv[2]);
1022 if (strlen(cwd) > 0)
1023 snprintf(fd_name, sizeof(fd_name), "%s/%s", cwd, argv[2]);
1025 snprintf(fd_name, sizeof(fd_name), "%s", argv[2]);
1029 printf("protocol-trace: %s\n", fd_name);
1031 if (!_e_info_client_eldbus_message_with_args("protocol_trace", NULL, "s", fd_name))
1036 _cb_protocol_rule(const Eldbus_Message *msg)
1038 const char *name = NULL, *text = NULL;
1042 res = eldbus_message_error_get(msg, &name, &text);
1043 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1045 res = eldbus_message_arguments_get(msg, "s", &reply);
1046 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1047 printf("%s\n", reply);
1050 if ((name) || (text ))
1052 printf("errname:%s errmsg:%s\n", name, text);
1057 _e_info_client_proc_protocol_rule(int argc, char **argv)
1060 char *new_s1 = NULL;
1061 char *new_s2 = NULL;
1064 Eina_Bool res = EINA_FALSE;
1067 (argc > 3 && !eina_streq(argv[2], "print") && !eina_streq(argv[2], "help") && !eina_streq(argv[2], "file") && !eina_streq(argv[2], "add") && !eina_streq(argv[2], "remove")))
1069 printf("protocol-trace: Usage> enlightenment_info -protocol_rule [add | remove | print | help] [allow/deny/all]\n");
1073 new_argc = argc - 2;
1074 for (i = 0; i < new_argc; i++)
1075 new_argv[i] = argv[i + 2];
1078 new_s1 = (char *)calloc (1, PATH_MAX);
1079 EINA_SAFETY_ON_NULL_RETURN(new_s1);
1081 snprintf(new_s1, PATH_MAX, "%s", "no_data");
1082 new_argv[1] = new_s1;
1087 new_s2 = (char *)calloc (1, PATH_MAX);
1088 EINA_SAFETY_ON_NULL_GOTO(new_s2, finish);
1090 snprintf(new_s2, PATH_MAX, "%s", "no_data");
1091 new_argv[2] = new_s2;
1096 printf("protocol-trace: Usage> enlightenment_info -protocol_rule [add | remove | print | help] [allow/deny/all]\n");
1100 res = _e_info_client_eldbus_message_with_args("protocol_rule", _cb_protocol_rule, "sss", new_argv[0], new_argv[1], new_argv[2]);
1101 if (!res) printf("Error occured while send send message\n\n");
1104 if (new_s1) free(new_s1);
1105 if (new_s2) free(new_s2);
1109 _cb_vec_info_get(const Eldbus_Message *msg)
1111 const char *name = NULL, *text = NULL;
1112 Eldbus_Message_Iter *array;
1115 res = eldbus_message_error_get(msg, &name, &text);
1116 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1118 res = eldbus_message_arguments_get(msg, "iia("VALUE_TYPE_FOR_TOPVWINS")", &e_info_client.hwc, &e_info_client.hwc_windows, &array);
1119 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1121 _e_win_info_make_array(array);
1124 if ((name) || (text))
1126 printf("errname:%s errmsg:%s\n", name, text);
1131 _e_info_client_proc_ec_list_info(Eina_Bool check_visible)
1136 int prev_layer = -1;
1139 const char *prev_layer_name = NULL;
1143 if (!_e_info_client_eldbus_message("get_ec_info", _cb_vec_info_get))
1148 if (!_e_info_client_eldbus_message("get_all_ec_info", _cb_vec_info_get))
1152 printf("\n\n%d Top level windows in EC list\n", eina_list_count(e_info_client.win_list));
1154 printf("--------------------------------------------[ topvwins ]------------------------------------------------------------------------------\n");
1156 printf("--------------------------------------------[ topwins ]------------------------------------------------------------------------------\n");
1157 if (e_info_client.hwc_windows)
1158 printf(" No Win_ID RcsID PID T w h x y L Zone Foc InReg Dep Opaq Vsbt Icon Vis Map Frame HWC_ST Parent TP Title\n");
1160 printf(" No Win_ID RcsID PID T w h x y L Zone Foc InReg Dep Opaq Vsbt Icon Vis Map Frame PL@ZPos Parent TP Title\n");
1161 printf("--------------------------------------------------------------------------------------------------------------------------------------\n");
1163 if (!e_info_client.win_list)
1169 EINA_LIST_FOREACH(e_info_client.win_list, l, win)
1174 if (win->layer != prev_layer)
1176 if (prev_layer != -1)
1177 printf("--------------------------------------------------------------------------------------------------------------------------------------[%s]\n",
1178 prev_layer_name ? prev_layer_name : " ");
1179 prev_layer = win->layer;
1180 prev_layer_name = win->layer_name;
1185 if (win->hwc_policy == E_HWC_POLICY_WINDOWS) // hwc windows
1187 switch(win->pl_zpos)
1189 case E_HWC_WINDOW_STATE_NONE: snprintf(tmp, sizeof(tmp), " NO "); break;
1190 case E_HWC_WINDOW_STATE_CLIENT: snprintf(tmp, sizeof(tmp), " CL "); break;
1191 case E_HWC_WINDOW_STATE_DEVICE: snprintf(tmp, sizeof(tmp), " DV "); break;
1192 case E_HWC_WINDOW_STATE_VIDEO: snprintf(tmp, sizeof(tmp), " VD "); break;
1193 case E_HWC_WINDOW_STATE_CURSOR: snprintf(tmp, sizeof(tmp), " CS "); break;
1194 default: snprintf(tmp, sizeof(tmp), " - "); break;
1199 if ((!win->iconic) && (win->frame_visible))
1201 if (win->pl_zpos == -999)
1202 snprintf(tmp, sizeof(tmp), " - ");
1205 if (win->hwc) snprintf(tmp, sizeof(tmp), "hwc@%i", win->pl_zpos);
1206 else snprintf(tmp, sizeof(tmp), "comp@%i", win->pl_zpos);
1210 snprintf(tmp, sizeof(tmp), " - ");
1216 snprintf(tmp, sizeof(tmp), " - ");
1219 printf("%3d 0x%08zx %5d %5d %c %5d %5d %6d %6d %c %2d %c %c %3d %2d ", i, win->id, win->res_id, win->pid, win->transformed ? 'O':' ', win->w, win->h, win->x, win->y, win->is_apply_layout ? 'L':' ', win->zone_id, win->focused ? 'O':' ', win->has_input_region?'C':' ', win->alpha? 32:24, win->opaque);
1220 printf("%2d%c %d %d %s %3d %-8s%-8zx %c %s\n", win->visibility, win->force_obscured ? 'f':' ', win->iconic, win->vis, win->mapped? "V":"N", win->frame_visible, tmp, win->parent_id, win->parent_id?(win->transient_policy?'B':'A'):' ',win->name?:"No Name");
1223 if (prev_layer_name)
1224 printf("--------------------------------------------------------------------------------------------------------------------------------------[%s]\n",
1228 printf("\nHWC is disabled\n\n");
1230 E_FREE_LIST(e_info_client.win_list, _e_win_info_free);
1231 if (e_info_client.engine)
1233 eina_stringshare_del(e_info_client.engine);
1234 e_info_client.engine = NULL;
1239 _e_info_client_proc_topvwins_info(int argc, char **argv)
1243 E_Zone_Info *zone_info;
1246 int prev_layer = -1;
1249 const char *prev_layer_name = NULL;
1251 if (!_e_info_client_eldbus_message("get_zone_info", _cb_zone_info_get))
1254 if (!_e_info_client_eldbus_message("get_window_info", _cb_vwindow_info_get))
1257 printf("GL : %s\n", e_info_client.use_gl ? "on":"off");
1258 printf("ENG: %s (config: %d)\n", e_info_client.engine, e_info_client.config_engine);
1259 if (e_info_client.use_hwc)
1261 if (e_info_client.hwc)
1264 if (e_info_client.hwc_windows)
1265 printf("hwc windows policy\n");
1267 printf("hwc planes policy and multiple plane is %s\n", e_info_client.use_multi_layer ? "on":"off");
1273 printf("HWC: configuration is off");
1275 printf("Buffer flush: %s\n", e_info_client.use_buffer_flush ? "on":"off");
1276 if (e_info_client.use_buffer_flush)
1277 printf("Deiconify Approve: %s\n", "auto on");
1279 printf("Deiconify Approve: %s\n", e_info_client.deiconify_approve ? "on":"off");
1281 EINA_LIST_FOREACH(e_info_client.zone_list, zl, zone_info)
1283 printf("\n====================================================================================================================================\n");
1284 printf("Zone[%d] Info %s\n", zone_info->id, zone_info->is_current ? "(current)" : "");
1285 printf("------------------------------------------------------------------------------------------------------------------------------------\n");
1287 printf("Geometry : %d,%d,%dx%d\n", zone_info->x, zone_info->y, zone_info->w, zone_info->h);
1288 if (zone_info->display_state == E_ZONE_DISPLAY_STATE_OFF)
1289 printf("Display State: %s\n", "Off");
1290 else if (zone_info->display_state == E_ZONE_DISPLAY_STATE_ON)
1291 printf("Display State: %s\n", "On");
1293 printf("Display State: %s\n", "Unknown");
1294 printf("Angle: Cur(%d), Active(%d)\n", zone_info->angle_cur, zone_info->angle_active);
1295 printf("------------------------------------------------------------------------------------------------------------------------------------\n");
1297 printf("%d Top level windows in evas object list\n", eina_list_count(e_info_client.win_list));
1298 printf("--------------------------------------[ topvwins ]----------------------------------------------------------------------------------\n");
1299 if (e_info_client.hwc_windows)
1300 printf(" No Win_ID RcsID PID w h x y L Zone Foc InReg Dep Opaq Vsbt Icon Vis Map Frame HWC_ST Parent TP Title\n");
1302 printf(" No Win_ID RcsID PID w h x y L Zone Foc InReg Dep Opaq Vsbt Icon Vis Map Frame PL@ZPos Parent TP Title\n");
1303 printf("------------------------------------------------------------------------------------------------------------------------------------\n");
1305 if (!e_info_client.win_list)
1307 printf("no window\n");
1311 EINA_LIST_FOREACH(e_info_client.win_list, l, win)
1313 if (!win) goto ec_info;
1314 if (win->zone_id != zone_info->id) continue;
1318 if (win->layer != prev_layer)
1320 if (prev_layer != -1)
1321 printf("------------------------------------------------------------------------------------------------------------------------------------[%s]\n",
1322 prev_layer_name ? prev_layer_name : " ");
1323 prev_layer = win->layer;
1324 prev_layer_name = win->layer_name;
1329 if (win->hwc_policy == E_HWC_POLICY_WINDOWS) // hwc windows
1331 switch(win->pl_zpos)
1333 case E_HWC_WINDOW_STATE_NONE: snprintf(tmp, sizeof(tmp), " NO "); break;
1334 case E_HWC_WINDOW_STATE_CLIENT: snprintf(tmp, sizeof(tmp), " CL "); break;
1335 case E_HWC_WINDOW_STATE_DEVICE: snprintf(tmp, sizeof(tmp), " DV "); break;
1336 case E_HWC_WINDOW_STATE_VIDEO: snprintf(tmp, sizeof(tmp), " VD "); break;
1337 case E_HWC_WINDOW_STATE_CURSOR: snprintf(tmp, sizeof(tmp), " CS "); break;
1338 default: snprintf(tmp, sizeof(tmp), " - "); break;
1343 if ((!win->iconic) && (win->frame_visible))
1345 if (win->pl_zpos == -999)
1346 snprintf(tmp, sizeof(tmp), " - ");
1349 if (win->hwc) snprintf(tmp, sizeof(tmp), "hwc@%i", win->pl_zpos);
1350 else snprintf(tmp, sizeof(tmp), "comp@%i", win->pl_zpos);
1354 snprintf(tmp, sizeof(tmp), " - ");
1360 snprintf(tmp, sizeof(tmp), " - ");
1363 printf("%3d 0x%08zx %5d %5d %5d %5d %6d %6d %c %2d %c %c %3d %2d ", i, win->id, win->res_id, win->pid, win->w, win->h, win->x, win->y, win->is_apply_layout ? 'L':' ', win->zone_id, win->focused ? 'O':' ', win->has_input_region?'C':' ', win->alpha? 32:24, win->opaque);
1364 printf("%2d%c %d %d %s %3d %-8s%-8zx %c %s\n", win->visibility, win->force_obscured ? 'f':' ', win->iconic, win->vis, win->mapped? "V":"N", win->frame_visible, tmp, win->parent_id, win->parent_id?(win->transient_policy?'B':'A'):' ',win->name?:"No Name");
1367 if (prev_layer_name)
1368 printf("------------------------------------------------------------------------------------------------------------------------------------[%s]\n\n",
1373 printf("\nHWC is disabled\n\n");
1375 E_FREE_LIST(e_info_client.win_list, _e_win_info_free);
1376 if (e_info_client.engine)
1378 eina_stringshare_del(e_info_client.engine);
1379 e_info_client.engine = NULL;
1383 _e_info_client_proc_ec_list_info(EINA_TRUE);
1388 _e_info_client_proc_topwins_info(int argc, char **argv)
1393 int prev_layer = -1;
1396 const char *prev_layer_name = NULL;
1398 if (!_e_info_client_eldbus_message("get_all_window_info", _cb_window_info_get))
1401 printf("%d Top level windows\n", eina_list_count(e_info_client.win_list));
1402 printf("--------------------------------------[ topwins ]----------------------------------------------------------------------------------\n");
1403 if (e_info_client.hwc_windows)
1404 printf(" No Win_ID RcsID PID w h x y L Zone Foc InReg Dep Opaq Vsbt Icon Vis Map Frame HWC_ST Parent TP Title\n");
1406 printf(" No Win_ID RcsID PID w h x y L Zone Foc InReg Dep Opaq Vsbt Icon Vis Map Frame PL@ZPos Parent TP Title\n");
1407 printf("------------------------------------------------------------------------------------------------------------------------------------\n");
1409 if (!e_info_client.win_list)
1411 printf("no window\n");
1415 EINA_LIST_FOREACH(e_info_client.win_list, l, win)
1417 if (!win) goto ec_info;
1420 if (win->layer != prev_layer)
1422 if (prev_layer != -1)
1423 printf("------------------------------------------------------------------------------------------------------------------------------------[%s]\n",
1424 prev_layer_name ? prev_layer_name : " ");
1425 prev_layer = win->layer;
1426 prev_layer_name = win->layer_name;
1431 if (win->hwc_policy == E_HWC_POLICY_WINDOWS) // hwc windows
1433 switch(win->pl_zpos)
1435 case E_HWC_WINDOW_STATE_NONE: snprintf(tmp, sizeof(tmp), " NO "); break;
1436 case E_HWC_WINDOW_STATE_CLIENT: snprintf(tmp, sizeof(tmp), " CL "); break;
1437 case E_HWC_WINDOW_STATE_DEVICE: snprintf(tmp, sizeof(tmp), " DV "); break;
1438 case E_HWC_WINDOW_STATE_VIDEO: snprintf(tmp, sizeof(tmp), " VD "); break;
1439 case E_HWC_WINDOW_STATE_CURSOR: snprintf(tmp, sizeof(tmp), " CS "); break;
1440 default: snprintf(tmp, sizeof(tmp), " - "); break;
1445 if ((!win->iconic) && (win->frame_visible))
1447 if (win->pl_zpos == -999)
1448 snprintf(tmp, sizeof(tmp), " - ");
1451 if (win->hwc) snprintf(tmp, sizeof(tmp), "hwc@%i", win->pl_zpos);
1452 else snprintf(tmp, sizeof(tmp), "comp@%i", win->pl_zpos);
1456 snprintf(tmp, sizeof(tmp), " - ");
1462 snprintf(tmp, sizeof(tmp), " - ");
1465 printf("%3d 0x%08zx %5d %5d %5d %5d %6d %6d %c %2d %c %c %3d %2d ", i, win->id, win->res_id, win->pid, win->w, win->h, win->x, win->y, win->is_apply_layout ? 'L':' ', win->zone_id, win->focused ? 'O':' ', win->has_input_region ? 'C':' ',win->alpha? 32:24, win->opaque);
1466 printf("%2d%c %d %d %s %3d %-8s%-8zx %c %s\n", win->visibility, win->force_obscured ? 'f':' ', win->iconic, win->vis, win->mapped? "V":"N", win->frame_visible, tmp, win->parent_id, win->parent_id?(win->transient_policy?'B':'A'):' ',win->name?:"No Name");
1469 if (prev_layer_name)
1470 printf("------------------------------------------------------------------------------------------------------------------------------------[%s]\n",
1474 printf("\nHWC is disabled\n\n");
1476 E_FREE_LIST(e_info_client.win_list, _e_win_info_free);
1479 _e_info_client_proc_ec_list_info(EINA_FALSE);
1483 _e_info_client_proc_compobjs_info(int argc, char **argv)
1487 if ((argc == 3) && (argv[2]))
1489 if (!strncmp(argv[2], "simple", 6))
1490 compobjs_simple = EINA_TRUE;
1493 res = _e_info_client_eldbus_message("compobjs",
1494 _e_info_client_cb_compobjs);
1495 EINA_SAFETY_ON_FALSE_RETURN(res);
1499 _e_info_client_proc_input_device_info(int argc, char **argv)
1501 if (!_e_info_client_eldbus_message("get_input_devices", _cb_input_device_info_get))
1506 _e_info_client_proc_keymap_info(int argc, char **argv)
1508 if (!_e_info_client_eldbus_message("get_keymap", _cb_input_keymap_info_get))
1513 _e_info_client_proc_module_info(int argc, char **argv)
1515 char fd_name[PATH_MAX];
1518 if (argc != 3 || !argv[2])
1520 printf("Usage> enlightenment_info -module_info [module name]\n");
1526 snprintf(fd_name, PATH_MAX, "/proc/%d/fd/1", pid);
1528 if (!_e_info_client_eldbus_message_with_args("get_module_info", NULL, "ss", argv[2], fd_name))
1533 _e_info_client_proc_keygrab_status(int argc, char **argv)
1535 char fd_name[PATH_MAX + PATH_MAX];
1539 if (argc != 3 || !argv[2])
1541 printf("Usage> enlightenment_info -keygrab_status [console | file path]\n");
1548 if (!getcwd(cwd, sizeof(cwd)))
1549 snprintf(cwd, sizeof(cwd), "/tmp");
1551 if (!strncmp(argv[2], "console", sizeof("console")))
1552 snprintf(fd_name, sizeof(fd_name), "/proc/%d/fd/1", pid);
1555 if (argv[2][0] == '/')
1556 snprintf(fd_name, sizeof(fd_name), "%s", argv[2]);
1559 if (strlen(cwd) > 0)
1560 snprintf(fd_name, sizeof(fd_name), "%s/%s", cwd, argv[2]);
1562 snprintf(fd_name, sizeof(fd_name), "%s", argv[2]);
1566 if (!_e_info_client_eldbus_message_with_args("get_keygrab_status", NULL, "s", fd_name))
1571 _directory_make(char *type, char *path)
1573 char dir[2048], curdir[1024], stamp[256];
1581 buf = calloc (1, sizeof (struct tm));
1582 EINA_SAFETY_ON_NULL_RETURN_VAL(buf, NULL);
1584 t = localtime_r(&timer, buf);
1588 printf("fail to get local time\n");
1592 fullpath = (char*) calloc(1, PATH_MAX*sizeof(char));
1596 printf("fail to alloc pathname memory\n");
1600 if (path && path[0] == '/')
1601 snprintf(dir, sizeof(dir), "%s", path);
1604 char *temp = getcwd(curdir, 1024);
1614 cur_len = strlen(curdir);
1615 len = sizeof(dir) - strlen(path) - cur_len - 2;
1617 if (cur_len == 1 && curdir[0] == '/')
1618 snprintf(dir, sizeof(dir), "/%s", path);
1620 snprintf(dir, sizeof(dir), "%s/%s", curdir, path);
1629 snprintf(dir, sizeof(dir), "%s", curdir);
1632 if (!(dp = opendir (dir)))
1636 printf("not exist: %s\n", dir);
1642 /* make the folder for the result of xwd files */
1643 snprintf(stamp, sizeof(stamp), "%04d%02d%02d.%02d%02d%02d", t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
1645 if (strlen(dir) == 1 && dir[0] == '/')
1646 snprintf(fullpath, PATH_MAX, "/%s-%s", type, stamp);
1648 snprintf(fullpath, PATH_MAX, "%s/%s-%s", dir, type, stamp);
1652 if ((mkdir(fullpath, 0755)) < 0)
1654 printf("fail: mkdir '%s'\n", fullpath);
1659 printf("directory: %s\n", fullpath);
1665 _e_info_client_cb_dump_wins(const Eldbus_Message *msg)
1667 const char *log = NULL;
1670 res = eldbus_message_arguments_get(msg, "s", &log);
1673 printf("Failed to get log of dump\n");
1678 printf("%s\n", log);
1682 _e_info_client_proc_wins_shot(int argc, char **argv)
1684 char *directory = NULL;
1687 if (eina_streq(argv[2], "topvwins") || eina_streq(argv[2], "ns") || eina_streq(argv[2], "hwc_wins"))
1690 directory = _directory_make(argv[2], NULL);
1692 directory = _directory_make(argv[2], argv[3]);
1697 if (!directory) goto arg_err;
1700 if (!_e_info_client_eldbus_message_with_args("dump_wins", _e_info_client_cb_dump_wins, SIGNATURE_DUMP_WINS, type, directory))
1710 printf("Usage: enlightenment_info -dump %s\n", USAGE_DUMPIMAGE);
1714 _e_info_client_cb_force_visible(const Eldbus_Message *msg)
1716 const char *name = NULL, *text = NULL;
1718 const char *result = NULL;
1720 res = eldbus_message_error_get(msg, &name, &text);
1721 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1723 res = eldbus_message_arguments_get(msg,
1724 SIGNATURE_FORCE_VISIBLE_SERVER,
1726 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1728 printf("%s\n", result);
1732 if ((name) || (text))
1734 printf("errname:%s errmsg:%s\n", name, text);
1739 _e_info_client_proc_force_visible(int argc, char **argv)
1741 unsigned int obj, visible;
1747 res = _util_string_to_uint(argv[2], &obj, 16);
1751 res = _util_string_to_uint(argv[3], &visible, 10);
1755 if (!_e_info_client_eldbus_message_with_args("set_force_visible", _e_info_client_cb_force_visible,
1756 SIGNATURE_FORCE_VISIBLE_CLIENT,
1757 obj, (visible) ? EINA_TRUE : EINA_FALSE))
1762 printf("Usage: enlightenment_info -set_force_visible [obj_pointer_address] [0 or 1]\n");
1766 _cb_subsurface_info_get(const Eldbus_Message *msg)
1768 const char *name = NULL, *text = NULL;
1769 Eldbus_Message_Iter *array, *ec;
1773 res = eldbus_message_error_get(msg, &name, &text);
1774 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1776 res = eldbus_message_arguments_get(msg, "a("SIGNATURE_SUBSURFACE")", &array);
1777 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1779 printf("--------------------------------------[ subsurfaces ]---------------------------------------------------------\n");
1780 printf(" No Win_ID Parent_ID Buf_ID w h x y Rot(f) Visi Alph Igno Mask Video Stand BgRect Title\n");
1781 printf("--------------------------------------------------------------------------------------------------------------\n");
1783 while (eldbus_message_iter_get_and_next(array, 'r', &ec))
1785 Ecore_Window win = 0, parent = 0, bgrect = 0;
1786 unsigned int buf_id = 0;
1787 int x = 0, y = 0, w = 0, h = 0;
1788 unsigned int transform = 0, visible = 0, alpha = 0, ignore = 0, maskobj = 0, video = 0, stand = 0;
1789 const char *name = NULL;
1790 char temp[128] = {0,};
1792 res = eldbus_message_iter_arguments_get(ec,
1793 SIGNATURE_SUBSURFACE,
1795 &buf_id, &x, &y, &w, &h, &transform,
1796 &visible, &alpha, &ignore, &maskobj, &video, &stand, &bgrect, &name);
1799 printf("Failed to get win info\n");
1805 printf("%3d 0x%08zx ", count, win);
1807 if (parent > 0) snprintf(temp, sizeof(temp), "0x%08zx", parent);
1808 printf("%10s", temp);
1811 snprintf(temp, sizeof(temp), "%5u%c",
1812 buf_id & (~WAYLAND_SERVER_RESOURCE_ID_MASK),
1813 (buf_id & WAYLAND_SERVER_RESOURCE_ID_MASK) ? 's' : 'c');
1814 printf(" %6s", temp);
1815 printf(" %4d %4d %4d %4d %3d(%d) %4s %4s %4s %4s %4s %4s ",
1816 w, h, x, y, (4 - (transform & 3)) * 90 % 360, (transform & 4) ? 1 : 0,
1817 (visible)?"O":"", (alpha)?"O":"", (ignore)?"O":"", (maskobj)?"O":"", (video)?"O":"", (stand)?"O":"");
1819 if (bgrect > 0) snprintf(temp, sizeof(temp), "0x%08zx", bgrect);
1820 printf("%10s", temp);
1821 printf(" %s\n", name);
1825 printf("no subsurface\n");
1828 if ((name) || (text))
1829 printf("errname:%s errmsg:%s\n", name, text);
1833 _e_info_client_proc_subsurface(int argc, char **argv)
1836 res = _e_info_client_eldbus_message("subsurface", _cb_subsurface_info_get);
1837 EINA_SAFETY_ON_FALSE_RETURN(res);
1841 _e_info_client_proc_eina_log_levels(int argc, char **argv)
1843 EINA_SAFETY_ON_FALSE_RETURN(argc == 3);
1844 EINA_SAFETY_ON_NULL_RETURN(argv[2]);
1846 if (!_e_info_client_eldbus_message_with_args("eina_log_levels", NULL, "s", argv[2]))
1853 _e_info_client_proc_eina_log_path(int argc, char **argv)
1855 char fd_name[PATH_MAX + PATH_MAX];
1859 EINA_SAFETY_ON_FALSE_RETURN(argc == 3);
1860 EINA_SAFETY_ON_NULL_RETURN(argv[2]);
1865 if (!getcwd(cwd, sizeof(cwd)))
1866 snprintf(cwd, sizeof(cwd), "/tmp");
1868 if (!strncmp(argv[2], "console", 7))
1869 snprintf(fd_name, sizeof(fd_name), "/proc/%d/fd/1", pid);
1872 if (argv[2][0] == '/')
1873 snprintf(fd_name, sizeof(fd_name), "%s", argv[2]);
1876 if (strlen(cwd) > 0)
1877 snprintf(fd_name, sizeof(fd_name), "%s/%s", cwd, argv[2]);
1879 snprintf(fd_name, sizeof(fd_name), "%s", argv[2]);
1883 printf("eina-log-path: %s\n", fd_name);
1885 if (!_e_info_client_eldbus_message_with_args("eina_log_path", NULL, "s", fd_name))
1893 _e_info_client_proc_dlog_switch(int argc, char **argv)
1897 EINA_SAFETY_ON_FALSE_RETURN(argc == 3);
1898 EINA_SAFETY_ON_NULL_RETURN(argv[2]);
1900 onoff = atoi(argv[2]);
1901 if ((onoff == 1) || (onoff == 0))
1904 if (!_e_info_client_eldbus_message_with_args("dlog", NULL, "i", onoff))
1906 printf("Error to switch %s logging system using dlog logging.", onoff?"on":"off");
1910 printf("Now you can try to track enlightenment log with dlog logging system.\n"
1911 "Track dlog with LOGTAG \"E20\" ex) dlogutil E20\n");
1913 printf("Logging of enlightenment with dlog is disabled.\n");
1918 #define PROP_USAGE \
1919 "0x<win_id> | -id win_id | -pid pid | -name \"win_name\" [property_name [property_value]]\n" \
1921 "\tenlightenment_info -prop : Get all properties for a window specified via a touch\n" \
1922 "\tenlightenment_info -prop Hidden : Get the \"Hidden\" property for a window specified via a touch\n" \
1923 "\tenlightenment_info -prop 0xb88ffaa0 Layer : Get the \"Layer\" property for specified window\n" \
1924 "\tenlightenment_info -prop 0xb88ffaa0 Hidden TRUE : Set the \"Hidden\" property for specified window\n" \
1925 "\tenlightenment_info -prop -pid 2502 Hidden FALSE : Set the \"Hidden\" property for all windows belonged to a process\n" \
1926 "\tenlightenment_info -prop -name err : Get all properties for windows whose names contain an \"err\" substring\n" \
1927 "\tenlightenment_info -prop -name \"\" : Get all properties for all windows\n" \
1928 "\tenlightenment_info -prop -name \"\" Hidden TRUE : Set the \"Hidden\" property for all windows\n"
1930 /* property value can consist of several lines separated by '\n', which we got to print nicely */
1932 _parse_property(const char *prop_name, const char *prop_value)
1934 char *begin, *end; /* current line */
1936 /* process a single line property value */
1937 if (!strchr(prop_value, '\n'))
1939 printf("%27s : %s\n", prop_name, prop_value);
1943 char *const tmp = strdup(prop_value);
1949 while (*begin != '\0')
1951 end = strchr(begin, '\n');
1955 printf("%27s : %s\n", begin == tmp ? prop_name : "", begin);
1957 /* it's the last line */
1968 _cb_window_prop_get(const Eldbus_Message *msg)
1970 const char *name = NULL, *text = NULL;
1971 Eldbus_Message_Iter *array, *ec;
1973 int first_delimiter = 1;
1975 res = eldbus_message_error_get(msg, &name, &text);
1976 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
1978 res = eldbus_message_arguments_get(msg, "a(ss)", &array);
1979 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
1981 while (eldbus_message_iter_get_and_next(array, 'r', &ec))
1983 const char *title = NULL;
1984 const char *value = NULL;
1986 res = eldbus_message_iter_arguments_get(ec,
1992 printf("Failed to get win prop info\n");
1996 if (title && !strncmp(title, "delimiter", sizeof("delimiter")))
1998 if (first_delimiter)
1999 first_delimiter = 0;
2001 printf("---------------------------------------------------------------------------------------------------------\n");
2004 _parse_property(title, value);
2012 if ((name) || (text))
2014 printf(" %s :: (%s)\n", name, text);
2019 _e_info_client_prop_prop_info(int argc, char **argv)
2021 const static int WINDOW_ID_MODE = 0;
2022 const static int WINDOW_PID_MODE = 1;
2023 const static int WINDOW_NAME_MODE = 2;
2025 const char *property_name = "", *property_value = "";
2027 int simple_mode = 1;
2030 char win_id[64] = {0, };
2032 /* for a window specified via a touch */
2033 /* TODO: what's about a property with "0x" as a substring? (e.g. kyky0xkyky) */
2034 if (argc < 3 || (argv[2][0] != '-' && !strstr(argv[2], "0x")))
2036 printf("Select the window whose property(ies) you wish to get/set\n");
2037 if (_e_get_window_under_touch(&win))
2039 printf("Error: cannot get window under touch\n");
2043 snprintf(win_id, sizeof(win_id), "%lu", (unsigned long int)win);
2045 mode = WINDOW_ID_MODE;
2048 if (argc > 2) property_name = argv[2];
2049 if (argc > 3) property_value = argv[3];
2053 if (argv[2][0] == '-' && argc < 4) goto error;
2055 if (argv[2][0] == '-')
2057 if (!strcmp(argv[2], "-id")) mode = WINDOW_ID_MODE;
2058 else if (!strcmp(argv[2], "-pid")) mode = WINDOW_PID_MODE;
2059 else if (!strcmp(argv[2], "-name")) mode = WINDOW_NAME_MODE;
2068 mode = WINDOW_ID_MODE;
2074 if (argc > 3) property_name = argv[3];
2075 if (argc > 4) property_value = argv[4];
2079 if (argc > 4) property_name = argv[4];
2080 if (argc > 5) property_value = argv[5];
2084 /* all checks about win_id/pid/win_name, property_name, property_value sanity are performed on server side,
2085 * in case of an error an error message contained error description will be returned */
2086 if (!_e_info_client_eldbus_message_with_args("get_window_prop", _cb_window_prop_get, "usss",
2087 mode, value, property_name, property_value))
2088 printf("_e_info_client_eldbus_message_with_args error");
2093 printf("Error Check Args: enlightenment_info -prop [property_name [property_value]]\n"
2094 " enlightenment_info -prop 0x<win_id> [property_name [property_value]]\n"
2095 " enlightenment_info -prop -id win_id [property_name [property_value]]\n"
2096 " enlightenment_info -prop -pid pid [property_name [property_value]]\n"
2097 " enlightenment_info -prop -name win_name [property_name [property_value]]\n");
2101 _cb_window_proc_connected_clients_get(const Eldbus_Message *msg)
2103 const char *name = NULL, *text = NULL;
2104 Eldbus_Message_Iter *array, *ec;
2107 res = eldbus_message_error_get(msg, &name, &text);
2108 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2110 res = eldbus_message_arguments_get(msg, "a(ss)", &array);
2111 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2113 printf("--------------------------------------[ connected clients ]-----------------------------------------------------\n");
2115 while (eldbus_message_iter_get_and_next(array, 'r', &ec))
2119 res = eldbus_message_iter_arguments_get(ec,
2125 printf("Failed to get connected clients info\n");
2129 if (!strcmp(title, "[Connected Clients]"))
2131 printf("\n[%2d] %s\n", ++cnt, value);
2133 else if (!strcmp(title, "[E_Client Info]"))
2135 printf(" |----- %s :: %s\n", title, value);
2140 if ((name) || (text))
2142 printf("errname:%s errmsg:%s\n", name, text);
2147 _e_info_client_proc_connected_clients(int argc, char **argv)
2149 if (!_e_info_client_eldbus_message("get_connected_clients", _cb_window_proc_connected_clients_get))
2151 printf("_e_info_client_eldbus_message error");
2156 #define ROTATION_USAGE \
2157 "[COMMAND] [ARG]...\n" \
2158 "\tset : Set the orientation of zone (Usage: set [zone-no] [rval(0|90|180|270)]\n" \
2159 "\tinfo : Get the information of zone's rotation (Usage: info [zone-no]) (Not Implemented)\n" \
2160 "\tenable : Enable the rotation of zone (Usage: enable [zone-no]\n" \
2161 "\tdisable : Disable the rotation of zone (Usage: disable [zone-no]\n"
2164 _cb_rotation_query(const Eldbus_Message *msg)
2167 /* TODO: need implementation */
2171 _e_info_client_proc_rotation(int argc, char **argv)
2173 E_Info_Rotation_Message req;
2174 int32_t zone_num = -1;
2176 const int off_len = 2, cmd_len = 1;
2177 Eina_Bool res = EINA_FALSE;
2179 if (argc < off_len + cmd_len)
2182 if (eina_streq(argv[off_len], "info"))
2184 if (argc > off_len + cmd_len)
2185 zone_num = atoi(argv[off_len + 1]);
2187 res = _e_info_client_eldbus_message_with_args("rotation_query",
2193 if (eina_streq(argv[off_len], "set"))
2195 if (argc < off_len + cmd_len + 1)
2197 else if (argc > off_len + cmd_len + 1)
2199 zone_num = atoi(argv[off_len + 1]);
2200 rval = atoi(argv[off_len + 2]);
2203 rval = atoi(argv[off_len + 1]);
2205 if ((rval < 0) || (rval > 270) || (rval % 90 != 0))
2208 req = E_INFO_ROTATION_MESSAGE_SET;
2212 if (argc > off_len + cmd_len)
2213 zone_num = atoi(argv[off_len + 1]);
2215 if (eina_streq(argv[off_len], "enable"))
2216 req = E_INFO_ROTATION_MESSAGE_ENABLE;
2217 else if (eina_streq(argv[off_len], "disable"))
2218 req = E_INFO_ROTATION_MESSAGE_DISABLE;
2223 res = _e_info_client_eldbus_message_with_args("rotation_message",
2225 req, zone_num, rval);
2229 printf("_e_info_client_eldbus_message_with_args error");
2233 printf("Usage: enlightenment_info -rotation %s", ROTATION_USAGE);
2236 #define RESLIST_USAGE \
2238 "\t-tree : All resources\n" \
2239 "\t-p {pid} : Specify client pid\n"
2243 DEFAULT_SUMMARY = 0,
2249 _pname_get(pid_t pid, char *name, int size)
2254 char proc[512], pname[512];
2257 snprintf(proc, 512,"/proc/%d/cmdline", pid);
2259 h = fopen(proc, "r");
2262 len = fread(pname, sizeof(char), 512, h);
2265 if ('\n' == pname[len - 1])
2266 pname[len - 1] = '\0';
2271 strncpy(name, pname, size);
2276 _cb_disp_res_lists_get(const Eldbus_Message *msg)
2278 const char *name = NULL, *text = NULL;
2279 Eldbus_Message_Iter *array, *resource;
2281 int nClient = 0, nResource = 0;
2282 char temp[PATH_MAX];
2285 res = eldbus_message_error_get(msg, &name, &text);
2286 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2288 res = eldbus_message_arguments_get(msg, "a("VALUE_TYPE_REPLY_RESLIST")", &array);
2289 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2291 snprintf(temp, PATH_MAX,"%6s %6s %s %s\n", "NO", "PID", "N_of_Res", "NAME");
2294 while (eldbus_message_iter_get_and_next(array, 'r', &resource))
2296 char cmd[512] = {0, };
2300 res = eldbus_message_iter_arguments_get(resource,
2301 VALUE_TYPE_REPLY_RESLIST,
2307 printf("Failed to get connected clients info\n");
2310 if (!strcmp(type, "[client]"))
2316 else if (!strcmp(type, "[count]"))
2318 nResource = (int)id;
2319 _pname_get(pid, cmd, sizeof(cmd));
2321 printf("%6d %6d %4d %9s\n", nClient, pid, nResource, cmd);
2327 if ((name) || (text))
2329 printf("errname:%s errmsg:%s\n", name, text);
2334 _cb_disp_res_lists_get_detail(const Eldbus_Message *msg)
2336 const char *name = NULL, *text = NULL;
2337 Eldbus_Message_Iter *array, *resource;
2339 int nClient = 0, nResource = 0;
2341 res = eldbus_message_error_get(msg, &name, &text);
2342 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2344 res = eldbus_message_arguments_get(msg, "a("VALUE_TYPE_REPLY_RESLIST")", &array);
2345 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2347 while (eldbus_message_iter_get_and_next(array, 'r', &resource))
2351 char cmd[512] = {0, };
2355 res = eldbus_message_iter_arguments_get(resource,
2356 VALUE_TYPE_REPLY_RESLIST,
2363 printf("Failed to get connected clients info\n");
2366 if (!strcmp(type, "[client]"))
2371 _pname_get(pid, cmd, sizeof(cmd));
2372 printf("[%2d] pid %d (%s)\n", nClient, pid, cmd);
2375 else if (!strcmp(type, "[resource]"))
2378 printf(" |----- %s obj@%u\n", item, id);
2384 if ((name) || (text))
2386 printf("errname:%s errmsg:%s\n", name, text);
2391 _e_info_client_proc_res_lists(int argc, char **argv)
2398 mode = DEFAULT_SUMMARY;
2399 if (!_e_info_client_eldbus_message_with_args("get_res_lists", _cb_disp_res_lists_get, VALUE_TYPE_REQUEST_RESLIST, mode, pid))
2401 printf("%s error\n", __FUNCTION__);
2407 if (eina_streq(argv[2], "-tree")) mode = TREE;
2410 if (!_e_info_client_eldbus_message_with_args("get_res_lists", _cb_disp_res_lists_get_detail, VALUE_TYPE_REQUEST_RESLIST, mode, pid))
2412 printf("%s error\n", __FUNCTION__);
2418 if (eina_streq(argv[2], "-p"))
2421 pid = atoi(argv[3]);
2422 if (pid <= 0) goto arg_err;
2426 if (!_e_info_client_eldbus_message_with_args("get_res_lists", _cb_disp_res_lists_get_detail, VALUE_TYPE_REQUEST_RESLIST, mode, pid))
2428 printf("%s error\n", __FUNCTION__);
2436 printf("Usage: enlightenment_info -reslist\n%s", RESLIST_USAGE);
2441 _opt_parse(char *opt, char *delims, int *vals, int n_vals)
2446 EINA_SAFETY_ON_FALSE_RETURN_VAL(n_vals > 0, EINA_FALSE);
2448 for (i = 0; i < n_vals; i++)
2450 res = _util_string_to_int_token(opt, &opt, &n, 10);
2451 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
2455 if ((strlen(opt) == 0) || (i == (n_vals - 1)))
2458 EINA_SAFETY_ON_TRUE_RETURN_VAL((*opt != delims[i]), EINA_FALSE);
2467 _e_info_client_proc_bgcolor_set(int argc, char **argv)
2469 int r = 0, g = 0, b = 0, a = 0;
2470 char delims_col[] = { ',', ',', ',', '\0' };
2471 int vals_col[] = { 0, 0, 0, 0};
2477 res = _opt_parse(argv[2], delims_col, vals_col, (sizeof(vals_col) / sizeof(int)));
2487 printf("(A, R, G, B) : %d, %d, %d, %d\n", a, r, g, b);
2489 res = _e_info_client_eldbus_message_with_args("bgcolor_set", NULL, "iiii", a, r, g, b);
2490 EINA_SAFETY_ON_FALSE_RETURN(res);
2495 printf("Wrong argument(s)! (<a>,<r>,<g>,<b>)\n");
2500 _e_info_client_proc_punch(int argc, char **argv)
2502 int onoff = 0, x = 0, y = 0, w = 0, h = 0;
2503 int a = 0, r = 0, g = 0, b = 0;
2504 char delims_geom[] = { 'x', '+', '+', '\0' };
2505 int vals_geom[] = { 0, 0, 0, 0 };
2506 char delims_col[] = { ',', ',', ',', '\0' };
2507 int vals_col[] = { 0, 0, 0, 0 };
2508 Eina_Bool res = EINA_FALSE;
2510 EINA_SAFETY_ON_FALSE_GOTO(argc >= 3, wrong_args);
2511 EINA_SAFETY_ON_NULL_GOTO(argv[2], wrong_args);
2513 if (!strncmp(argv[2], "on", 2)) onoff = 1;
2515 if (argc >= 4 && argv[3])
2517 res = _opt_parse(argv[3], delims_geom, vals_geom, (sizeof(vals_geom) / sizeof(int)));
2518 EINA_SAFETY_ON_FALSE_GOTO(res, wrong_args);
2520 w = vals_geom[0]; h = vals_geom[1]; x = vals_geom[2]; y = vals_geom[3];
2523 if (argc >= 5 && argv[4])
2525 res = _opt_parse(argv[4], delims_col, vals_col, (sizeof(vals_col) / sizeof(int)));
2526 EINA_SAFETY_ON_FALSE_GOTO(res, wrong_args);
2528 a = vals_col[0]; r = vals_col[1]; g = vals_col[2]; b = vals_col[3];
2531 res = _e_info_client_eldbus_message_with_args("punch", NULL, "iiiiiiiii", onoff, x, y, w, h, a, r, g, b);
2532 if (!res) printf("Error occured while send send message\n\n");
2537 printf("wrong geometry arguments(<w>x<h>+<x>+<y>\n");
2538 printf("wrong color arguments(<a>,<r>,<g>,<b>)\n");
2542 _e_info_client_proc_transform_set(int argc, char **argv)
2544 int32_t id_enable_xy_sxsy_angle[8];
2545 const char *role = "winfo test";
2550 printf("Error Check Args: enlightenment_info -transform [windowID] [transform id] [enable] [x] [y] [scale_x(percent)] [scale_y(percent)] [degree] [background] [role(optional)]\n");
2554 id_enable_xy_sxsy_angle[0] = 0; // transform id
2555 id_enable_xy_sxsy_angle[1] = 1; // enable
2556 id_enable_xy_sxsy_angle[2] = 0; // move x
2557 id_enable_xy_sxsy_angle[3] = 0; // move y
2558 id_enable_xy_sxsy_angle[4] = 100; // scale x percent
2559 id_enable_xy_sxsy_angle[5] = 100; // scale y percent
2560 id_enable_xy_sxsy_angle[6] = 0; // rotation degree
2561 id_enable_xy_sxsy_angle[7] = 0; // background
2563 for (i = 0 ; i < 8 && i+3 < argc; ++i)
2564 id_enable_xy_sxsy_angle[i] = atoi(argv[i+3]);
2569 if (!_e_info_client_eldbus_message_with_args("transform_message", NULL, "siiiiiiiis",
2570 argv[2], id_enable_xy_sxsy_angle[0] , id_enable_xy_sxsy_angle[1], id_enable_xy_sxsy_angle[2],
2571 id_enable_xy_sxsy_angle[3], id_enable_xy_sxsy_angle[4], id_enable_xy_sxsy_angle[5],
2572 id_enable_xy_sxsy_angle[6], id_enable_xy_sxsy_angle[7], role))
2574 printf("_e_info_client_eldbus_message_with_args error");
2579 #define DUMP_BUFFERS_USAGE \
2580 " enlightenment_info -dump_buffers [ARG]...\n" \
2581 " enlightenment_info -dump_buffers 1 : start dump buffer (default - buffer_count:100, path:/tmp/dump_xxxx/\n" \
2582 " enlightenment_info -dump_buffers 1 -m : start dump buffer with marking of various color\n" \
2583 " enlightenment_info -dump_buffers 1 -c 50 : start dump buffer with 50 buffers\n" \
2584 " enlightenment_info -dump_buffers 1 -p /tmp/test : start dump buffer - the dump path is '/tmp/test/dump_xxxx'\n" \
2585 " enlightenment_info -dump_buffers 1 -c 60 -p /test : start dump buffer with 60 buffers to '/test/dump_xxxx' folder\n" \
2586 " enlightenment_info -dump_buffers 0 : stop dump buffer (store dump files to dump path)\n" \
2587 " enlightenment_info -dump_buffers 1 -s 0.5 : start dump buffer with 0.5 scale factor\n" \
2588 " enlightenment_info -dump_buffers 1 -w Wind_ID or server or client : start dump buffer with specific window or server or client\n" \
2589 " enlightenment_info -dump_selected_buffers Win_ID(from enlightenment_info -topvwins) : dump Win_ID(store dump files to dump path)\n" \
2592 _buffer_shot_directory_check(char *path)
2594 char dir[PATH_MAX], curdir[1024];
2598 fullpath = (char*)calloc(1, PATH_MAX * sizeof(char));
2601 printf("fail to alloc pathname memory\n");
2605 if (path && path[0] == '/')
2606 snprintf(dir, PATH_MAX, "%s", path);
2609 char *temp = getcwd(curdir, 1024);
2617 if (strlen(curdir) == 1 && curdir[0] == '/')
2618 snprintf(dir, PATH_MAX, "/%s", path);
2620 snprintf(dir, PATH_MAX, "%s/%s", curdir, path);
2623 snprintf(dir, PATH_MAX, "%s", curdir);
2626 if (!(dp = opendir(dir)))
2629 printf("not exist: %s\n", dir);
2635 snprintf(fullpath, PATH_MAX, "%s", dir);
2641 _e_info_client_proc_desk(int argc, char **argv)
2643 const int offset = 2, cmd_len = 1;
2644 Eina_Bool res = EINA_FALSE;
2646 if (argc < offset + cmd_len)
2649 if (eina_streq(argv[offset], "geometry"))
2655 if (argc < offset + cmd_len + narg)
2658 for (i = 0; i < narg; i++)
2659 geom[i] = atoi(argv[offset + cmd_len + i]);
2661 if ((geom[2] < 0) || (geom[3] < 0))
2663 printf("Error Check Args: Width(%d) and Height(%d) must not be less than 1.\n", geom[2], geom[3]);
2667 res = _e_info_client_eldbus_message_with_args("desktop_geometry_set", NULL, "iiii",
2668 geom[0], geom[1], geom[2], geom[3]);
2670 else if (eina_streq(argv[offset], "zoom"))
2676 if (argc < offset + cmd_len + narg)
2679 zx = atof(argv[offset + cmd_len]);
2680 zy = atof(argv[offset + cmd_len + 1]);
2681 cx = atoi(argv[offset + cmd_len + 2]);
2682 cy = atoi(argv[offset + cmd_len + 3]);
2684 res = _e_info_client_eldbus_message_with_args("desk_zoom", NULL, "ddii",
2687 else if (eina_streq(argv[offset], "iconify"))
2690 res = _e_info_client_eldbus_message_with_args("desktop_window_control", NULL, "i", option);
2692 else if (eina_streq(argv[offset], "restore"))
2695 res = _e_info_client_eldbus_message_with_args("desktop_window_control", NULL, "i", option);
2697 else if (eina_streq(argv[offset], "clear"))
2700 res = _e_info_client_eldbus_message_with_args("desktop_window_control", NULL, "i", option);
2702 else if (eina_streq(argv[offset], "iconify_toggle"))
2705 res = _e_info_client_eldbus_message_with_args("desktop_window_control", NULL, "i", option);
2710 printf("_e_info_client_eldbus_message_with_args error");
2716 printf("Usage: enlightenment_info -desk\n");
2720 _e_info_client_proc_desk_area(int argc, char **argv)
2722 const int offset = 2, base_cmd_len = 1;
2723 Eina_Bool res = EINA_FALSE;
2724 int sub_cmd_len = 0;
2726 if (argc < offset + base_cmd_len)
2729 if (eina_streq(argv[offset], "info"))
2731 res = _e_info_client_eldbus_message("desk_area_info", NULL);
2733 else if (eina_streq(argv[offset], "enable"))
2736 if (argc < offset + base_cmd_len + sub_cmd_len)
2740 enable = atoi(argv[offset+1]);
2742 if (enable == 1 || enable == 0)
2744 res = _e_info_client_eldbus_message_with_args("desk_area_enable", NULL, "i", enable);
2747 else if (eina_streq(argv[offset], "make_sub1"))
2750 if (argc < offset + base_cmd_len + sub_cmd_len)
2753 int x, y, w, h, layer;
2755 x = atoi(argv[offset + base_cmd_len]);
2756 y = atoi(argv[offset + base_cmd_len + 1]);
2757 w = atoi(argv[offset + base_cmd_len + 2]);
2758 h = atoi(argv[offset + base_cmd_len + 3]);
2759 layer = atoi(argv[offset + base_cmd_len + 4]);
2761 res = _e_info_client_eldbus_message_with_args("desk_area_new_sub1", NULL, "iiiii", x, y, w, h, layer);
2763 else if (eina_streq(argv[offset], "make_sub2"))
2766 if (argc < offset + base_cmd_len + sub_cmd_len)
2769 int x, y, w, h, layer;
2771 x = atoi(argv[offset + base_cmd_len]);
2772 y = atoi(argv[offset + base_cmd_len + 1]);
2773 w = atoi(argv[offset + base_cmd_len + 2]);
2774 h = atoi(argv[offset + base_cmd_len + 3]);
2775 layer = atoi(argv[offset + base_cmd_len + 4]);
2777 res = _e_info_client_eldbus_message_with_args("desk_area_new_sub2", NULL, "iiiii", x, y, w, h, layer);
2779 else if (eina_streq(argv[offset], "remove_sub1"))
2782 res = _e_info_client_eldbus_message_with_args("desk_area_remove_sub", NULL, "i", id);
2784 else if (eina_streq(argv[offset], "remove_sub2"))
2787 res = _e_info_client_eldbus_message_with_args("desk_area_remove_sub", NULL, "i", id);
2789 else if (eina_streq(argv[offset], "raise_base"))
2792 if (argc < offset + base_cmd_len + sub_cmd_len)
2796 raise = atoi(argv[offset+1]);
2798 if (raise == 1 || raise == 0)
2800 res = _e_info_client_eldbus_message_with_args("desk_area_base_raise", NULL, "i", raise);
2803 else if (eina_streq(argv[offset], "raise_sub1"))
2806 if (argc < offset + base_cmd_len + sub_cmd_len)
2810 raise = atoi(argv[offset+1]);
2812 if (raise == 1 || raise == 0)
2814 res = _e_info_client_eldbus_message_with_args("desk_area_sub1_raise", NULL, "i", raise);
2817 else if (eina_streq(argv[offset], "raise_sub2"))
2820 if (argc < offset + base_cmd_len + sub_cmd_len)
2824 raise = atoi(argv[offset+1]);
2826 if (raise == 1 || raise == 0)
2828 res = _e_info_client_eldbus_message_with_args("desk_area_sub2_raise", NULL, "i", raise);
2831 else if (eina_streq(argv[offset], "check_stack"))
2833 res = _e_info_client_eldbus_message("desk_area_check_stack", NULL);
2841 printf("_e_info_client_eldbus_message_with_args error");
2847 printf("Usage: enlightenment_info -desk_area -h\n");
2851 _cb_buffer_shot(const Eldbus_Message *msg)
2853 const char *name = NULL, *text = NULL;
2854 char *fullpath = NULL;
2858 res = eldbus_message_error_get(msg, &name, &text);
2859 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
2861 res = eldbus_message_arguments_get(msg, "is", &error, &fullpath);
2862 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
2864 if (strcmp(fullpath, "nopath") && !e_info_client.dump_fullpath)
2865 e_info_client.dump_fullpath = eina_stringshare_add(fullpath);
2866 e_info_client.dump_success = error;
2869 if ((name) || (text))
2871 printf("errname:%s errmsg:%s\n", name, text);
2876 _e_info_client_proc_buffer_shot(int argc, char **argv)
2878 const char *win_id = "";
2882 char path[PATH_MAX];
2886 strncpy(path, "/tmp", PATH_MAX);
2888 EINA_SAFETY_ON_TRUE_GOTO(argc < 3, err);
2890 dumprun = atoi(argv[2]);
2892 EINA_SAFETY_ON_TRUE_GOTO(dumprun < 0 || dumprun > 1, err);
2894 for (i = 3; i < argc; i++)
2896 if (eina_streq(argv[i], "-c"))
2898 if (++i >= argc || (argv[i][0] < '0' || argv[i][0] > '9'))
2900 printf("Error: -c requires argument\n");
2903 count = atoi(argv[i]);
2904 EINA_SAFETY_ON_TRUE_GOTO(count < 1, err);
2908 if (eina_streq(argv[i], "-p"))
2915 printf("Error: -p requires argument\n");
2918 tmp_path = _buffer_shot_directory_check(argv[i]);
2919 if (tmp_path == NULL)
2921 printf("cannot find directory: %s\n", argv[i]);
2925 str_len = strlen(tmp_path);
2926 if (str_len >= PATH_MAX) str_len = PATH_MAX - 1;
2928 strncpy(path, tmp_path, str_len);
2934 if (eina_streq(argv[i], "-s"))
2936 if (++i >= argc || (argv[i][0] < '0' || argv[i][0] > '9'))
2938 printf("Error: -s requires argument\n");
2941 scale = atof(argv[i]);
2942 EINA_SAFETY_ON_TRUE_GOTO(scale <= 0.0, err);
2945 if (eina_streq(argv[i], "-m"))
2952 if (eina_streq(argv[i], "-w"))
2956 printf("Error: -w requires argument\n");
2967 if (!_e_info_client_eldbus_message_with_args_timeout("dump_buffers", _cb_buffer_shot,
2968 ELDBUS_TIMEOUT_INFINITE, "iisdis",
2969 dumprun, count, path, scale, mark, win_id))
2971 printf("dump_buffers fail (%d)\n", dumprun);
2975 printf("dump_buffers %s %s.\n",
2976 (dumprun == 1 ? "start" : "stop"), (e_info_client.dump_success == 0 ? "success" : "fail"));
2978 if (e_info_client.dump_fullpath)
2980 if (dumprun == 0 && e_info_client.dump_success == 0 && e_info_client.dump_fullpath)
2981 printf("saved : %s\n", e_info_client.dump_fullpath);
2983 eina_stringshare_del(e_info_client.dump_fullpath);
2984 e_info_client.dump_fullpath = NULL;
2990 printf("Error Check Args\n%s\n", DUMP_BUFFERS_USAGE);
2995 _e_info_client_cb_selected_buffer(const Eldbus_Message *msg)
2997 const char *log = NULL;
3000 res = eldbus_message_arguments_get(msg, "s", &log);
3003 printf("Failed to get log of dump\n");
3008 printf("%s\n", log);
3012 _e_info_client_proc_selected_buffer_shot(int argc, char **argv)
3014 const char *win_id=NULL;
3015 char path[PATH_MAX];
3017 strncpy(path, "/tmp", PATH_MAX);
3022 if (!_e_info_client_eldbus_message_with_args("dump_selected_buffers", _e_info_client_cb_selected_buffer, "ss", win_id, path))
3024 printf("_e_info_client_proc_selected_buffer_shot fail (%s)\n", win_id);
3034 printf("Error Check Args\n%s\n", DUMP_BUFFERS_USAGE);
3039 _e_info_client_proc_screen_shot_name_check(const char *name, int length)
3044 if (name[length - 1] != 'g' || name[length - 2] != 'n' ||
3045 name[length - 3] != 'p' || name[length - 4] != '.')
3052 _e_info_client_proc_screen_shot(int argc, char **argv)
3060 Eina_Bool p = EINA_FALSE;
3061 Eina_Bool n = EINA_FALSE;
3063 for (i = 2; i < argc; i++)
3065 if (eina_streq(argv[i], "-p"))
3071 printf("Error: -p requires argument\n");
3075 tmp_path = _buffer_shot_directory_check(argv[i]);
3076 if (tmp_path == NULL)
3078 printf("cannot find directory: %s, make directory before dump\n", argv[i]);
3088 if (eina_streq(argv[i], "-n"))
3092 printf("Error: -n requires argument\n");
3105 path = (char *)calloc(1, PATH_MAX * sizeof(char));
3106 EINA_SAFETY_ON_NULL_RETURN(path);
3107 strncpy(path, "/tmp/", PATH_MAX);
3111 name = (char *)calloc(1, PATH_MAX * sizeof(char));
3112 EINA_SAFETY_ON_NULL_GOTO(name, err);
3113 strncpy(name, "dump_screen.png", PATH_MAX);
3116 if ((!path) || (!name)) goto err;
3118 path_len = strlen(path);
3119 name_len = strlen(name);
3123 if (!_e_info_client_proc_screen_shot_name_check(name, name_len))
3125 printf("Error: support only 'png' file\n write like -n xxx.png\n");
3130 if (path_len + name_len >= PATH_MAX)
3132 printf("_e_info_client_proc_screen_shot fail. long name\n");
3136 fname = (char *)calloc(1, PATH_MAX * sizeof(char));
3137 EINA_SAFETY_ON_NULL_GOTO(fname, err);
3138 if (path[path_len - 1] == '/')
3139 snprintf(fname, PATH_MAX, "%s%s", path, name);
3141 snprintf(fname, PATH_MAX, "%s/%s", path, name);
3143 printf("make dump: %s\n", fname);
3145 if (!_e_info_client_eldbus_message_with_args("dump_screen", NULL, "s", fname))
3146 printf("_e_info_client_proc_screen_shot fail\n");
3151 if (fname) free(fname);
3157 static E_Info_Output_Mode *
3158 _e_output_mode_info_new(uint32_t h, uint32_t hsync_start, uint32_t hsync_end, uint32_t htotal,
3159 uint32_t v, uint32_t vsync_start, uint32_t vsync_end, uint32_t vtotal,
3160 uint32_t refresh, uint32_t vscan, uint32_t clock, uint32_t flags,
3161 int current, int output, int connect, const char *name, int dpms)
3163 E_Info_Output_Mode *mode = NULL;
3165 mode = E_NEW(E_Info_Output_Mode, 1);
3166 EINA_SAFETY_ON_NULL_RETURN_VAL(mode, NULL);
3169 mode->hsync_start = hsync_start;
3170 mode->hsync_end = hsync_end;
3171 mode->htotal = htotal;
3173 mode->vsync_start = vsync_start;
3174 mode->vsync_end = vsync_end;
3175 mode->vtotal = vtotal;
3176 mode->refresh = refresh;
3177 mode->vscan = vscan;
3178 mode->clock = clock;
3179 mode->flags = flags;
3180 mode->current = current;
3181 mode->output = output;
3182 mode->connect = connect;
3183 mode->name = eina_stringshare_add(name);
3190 _e_output_mode_info_free(E_Info_Output_Mode *mode)
3192 EINA_SAFETY_ON_NULL_RETURN(mode);
3195 eina_stringshare_del(mode->name);
3201 _cb_output_mode_info(const Eldbus_Message *msg)
3203 const char *name = NULL, *text = NULL;
3204 Eldbus_Message_Iter *array, *ec;
3208 res = eldbus_message_error_get(msg, &name, &text);
3209 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
3211 res = eldbus_message_arguments_get(msg, "a("SIGNATURE_OUTPUT_MODE_SERVER")", &array);
3212 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
3214 while (eldbus_message_iter_get_and_next(array, 'r', &ec))
3216 uint32_t h, hsync_start, hsync_end, htotal;
3217 uint32_t v, vsync_start, vsync_end, vtotal;
3218 uint32_t refresh, vscan, clock, flag;
3219 int current, output, connect, dpms;
3221 E_Info_Output_Mode *mode = NULL;
3222 res = eldbus_message_iter_arguments_get(ec,
3223 SIGNATURE_OUTPUT_MODE_SERVER,
3224 &h, &hsync_start, &hsync_end, &htotal,
3225 &v, &vsync_start, &vsync_end, &vtotal,
3226 &refresh, &vscan, &clock, &flag, &name,
3227 ¤t, &output, &connect, &gl, &dpms);
3230 printf("Failed to get output mode info\n");
3234 mode = _e_output_mode_info_new(h, hsync_start, hsync_end, htotal,
3235 v, vsync_start, vsync_end, vtotal,
3236 refresh, vscan, clock, flag,
3237 current, output, connect, name, dpms);
3238 e_info_client.mode_list = eina_list_append(e_info_client.mode_list, mode);
3240 e_info_client.gl = gl;
3243 if ((name) || (text))
3245 printf("errname:%s errmsg:%s\n", name, text);
3250 _e_info_client_proc_output_mode(int argc, char **argv)
3252 E_Info_Output_Mode *mode = NULL;
3258 const char *str_dpms[] = {
3268 if (!_e_info_client_eldbus_message_with_args("output_mode", _cb_output_mode_info,
3269 SIGNATURE_OUTPUT_MODE_CLIENT, E_INFO_CMD_OUTPUT_MODE_GET, 0))
3271 printf("_e_info_client_proc_output_mode fail (%d)\n", E_INFO_CMD_OUTPUT_MODE_GET);
3277 if ((argv[2][0] < '0' || argv[2][0] > '9') ||
3278 (argv[3][0] < '0' || argv[3][0] > '9'))
3280 printf("Error: invalid argument\n");
3281 printf("Usage: -output_mode [output idx] [mode number]\n");
3285 output_idx = atoi(argv[2]);
3286 count = atoi(argv[3]);
3287 if (!_e_info_client_eldbus_message_with_args("output_mode", _cb_output_mode_info,
3288 SIGNATURE_OUTPUT_MODE_CLIENT, E_INFO_CMD_OUTPUT_MODE_SET, output_idx, count))
3290 printf("_e_info_client_proc_output_mode fail (%d)\n", E_INFO_CMD_OUTPUT_MODE_SET);
3296 printf("Error: invalid argument\n");
3297 printf("Usage: -output_mode [output idx] [mode number]\n");
3301 if (!e_info_client.mode_list)
3303 printf("no list\n");
3307 if (e_info_client.gl == 0)
3309 E_FREE_LIST(e_info_client.mode_list, _e_output_mode_info_free);
3311 printf("not support output_mode.\n");
3315 printf("--------------------------------------[ output mode ]---------------------------------------------\n");
3316 printf(" idx modename h hss hse htot v vss vse vtot refresh clk vscan preferred current\n");
3317 printf("--------------------------------------------------------------------------------------------------\n");
3319 EINA_LIST_FOREACH(e_info_client.mode_list, l, mode)
3323 if (output == mode->output)
3325 printf("output %u : ", mode->output);
3329 if (mode->connect == 1)
3330 printf("%s, %s\n", "connected", str_dpms[mode->dpms]);
3333 printf("%s, %s\n", "disconnected", str_dpms[mode->dpms]);
3338 if (mode->current == 1)
3343 printf("%3d%13s %5u%5u%5u%5u%5u%5u%5u%5u %3u %8u %2u ",
3345 mode->hdisplay, mode->hsync_start, mode->hsync_end, mode->htotal,
3346 mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal,
3347 mode->refresh, mode->clock, mode->vscan);
3349 if (mode->flags == 1)
3350 printf("O %c\n", curr);
3352 printf(" %c\n", curr);
3355 E_FREE_LIST(e_info_client.mode_list, _e_output_mode_info_free);
3363 _e_info_client_proc_trace(int argc, char **argv)
3370 onoff = atoi(argv[3]);
3372 if (onoff == 1 || onoff == 0)
3374 if (eina_streq(argv[2], "hwc"))
3376 if (!_e_info_client_eldbus_message_with_args("trace_message_hwc", NULL, "i", onoff))
3378 printf("_e_info_client_eldbus_message_with_args error");
3382 else if (eina_streq(argv[2], "prstt"))
3384 if (!_e_info_client_eldbus_message_with_args("trace_message_prstt", NULL, "i", onoff))
3386 printf("_e_info_client_eldbus_message_with_args error");
3390 else if (eina_streq(argv[2], "exsync"))
3392 if (!_e_info_client_eldbus_message_with_args("trace_message_exsync", NULL, "i", onoff))
3394 printf("_e_info_client_eldbus_message_with_args error");
3398 else if (eina_streq(argv[2], "damage"))
3400 if (!_e_info_client_eldbus_message_with_args("trace_message_damage", NULL, "i", onoff))
3402 printf("_e_info_client_eldbus_message_with_args error");
3409 printf("Error Check Args: enlightenment_info -trace %s\n", USAGE_TRACE);
3413 _e_info_client_proc_hwc(int argc, char **argv)
3420 param = atoi(argv[2]);
3422 if (param == 1 || param == 0 || param == 2)
3424 if (!_e_info_client_eldbus_message_with_args("hwc", NULL, "i", param))
3426 printf("_e_info_client_eldbus_message_with_args error");
3432 printf("Error Check Args: enlightenment_info -hwc [0: off, 1: on, 2: info]\n");
3437 _e_info_client_proc_show_plane_state(int argc, char **argv)
3439 if (!_e_info_client_eldbus_message("show_plane_state", NULL))
3442 printf("e20 print planes state with eina_log\n");
3445 static E_Pending_Commit_Info *
3446 _e_pending_commit_info_new(unsigned int plane, int zpos, unsigned int data, unsigned int tsurface)
3448 E_Pending_Commit_Info *pending_commit = NULL;
3450 pending_commit = E_NEW(E_Pending_Commit_Info, 1);
3451 EINA_SAFETY_ON_NULL_RETURN_VAL(pending_commit, NULL);
3453 pending_commit->plane = plane;
3454 pending_commit->zpos = zpos;
3455 pending_commit->data = data;
3456 pending_commit->tsurface = tsurface;
3458 return pending_commit;
3462 _e_pending_commit_info_free(E_Pending_Commit_Info *pending_commit)
3464 E_FREE(pending_commit);
3468 _cb_pending_commit_info_get(const Eldbus_Message *msg)
3470 const char *name = NULL, *text = NULL;
3471 Eldbus_Message_Iter *array, *eldbus_msg;
3474 res = eldbus_message_error_get(msg, &name, &text);
3475 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
3477 res = eldbus_message_arguments_get(msg, "a("VALUE_TYPE_FOR_PENDING_COMMIT")", &array);
3478 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
3480 while (eldbus_message_iter_get_and_next(array, 'r', &eldbus_msg))
3482 E_Pending_Commit_Info *pending_commit = NULL;
3483 unsigned int plane, tsurface, data;
3485 res = eldbus_message_iter_arguments_get(eldbus_msg,
3486 VALUE_TYPE_FOR_PENDING_COMMIT,
3493 printf("Failed to get pending_commit info\n");
3497 pending_commit = _e_pending_commit_info_new(plane, zpos, data, tsurface);
3498 if (!pending_commit) continue;
3500 e_info_client.pending_commit_list = eina_list_append(e_info_client.pending_commit_list, pending_commit);
3504 if ((name) || (text))
3506 printf("errname:%s errmsg:%s\n", name, text);
3511 _e_info_client_proc_show_pending_commit(int argc, char **argv)
3515 E_Pending_Commit_Info *pending_commit;
3517 if (!_e_info_client_eldbus_message("show_pending_commit", _cb_pending_commit_info_get))
3520 printf("----------------------------[ pending commit ]-----------------------------------\n");
3521 printf(" No Plane Zpos Data tsurface\n");
3522 printf("---------------------------------------------------------------------------------\n");
3524 if (!e_info_client.pending_commit_list)
3526 printf("no peding commit\n");
3530 EINA_LIST_FOREACH(e_info_client.pending_commit_list, l, pending_commit)
3533 printf("%3d %12zx %5d %12zx %12zx\n",
3535 (uintptr_t)pending_commit->plane,
3536 pending_commit->zpos,
3537 (uintptr_t)pending_commit->data,
3538 (uintptr_t)pending_commit->tsurface);
3541 E_FREE_LIST(e_info_client.pending_commit_list, _e_pending_commit_info_free);
3545 _e_fps_info_new(E_Info_Fps_Type type, const char *output, int zpos, unsigned int window, double fps)
3547 E_Fps_Info *fps_info = NULL;
3549 fps_info = E_NEW(E_Fps_Info, 1);
3550 EINA_SAFETY_ON_NULL_RETURN_VAL(fps_info, NULL);
3552 fps_info->type = type;
3553 fps_info->output = output;
3554 fps_info->zpos = zpos;
3555 fps_info->window = window;
3556 fps_info->fps = fps;
3562 _e_fps_info_free(E_Fps_Info *fps)
3568 _cb_fps_info_get(const Eldbus_Message *msg)
3570 const char *name = NULL, *text = NULL;
3571 Eldbus_Message_Iter *array, *eldbus_msg;
3574 res = eldbus_message_error_get(msg, &name, &text);
3575 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
3577 res = eldbus_message_arguments_get(msg, "a("VALUE_TYPE_FOR_FPS")", &array);
3578 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
3580 while (eldbus_message_iter_get_and_next(array, 'r', &eldbus_msg))
3582 E_Fps_Info *fps_info = NULL;
3586 unsigned int window;
3587 res = eldbus_message_iter_arguments_get(eldbus_msg,
3596 printf("Failed to get fps info\n");
3600 fps_info = _e_fps_info_new(type, output, zpos, window, fps);
3601 if (!fps_info) continue;
3603 e_info_client.fps_list = eina_list_append(e_info_client.fps_list, fps_info);
3607 if ((name) || (text))
3609 printf("errname:%s errmsg:%s\n", name, text);
3614 "[COMMAND] [ARG]...\n" \
3615 "\t-help : print this message.\n" \
3616 "\t-win_id : print client fps.\n" \
3619 "\twinfo -fps -win_id [win_id]\n" \
3622 _e_info_client_proc_fps_info(int argc, char **argv)
3624 char *win_id = "none";
3628 if (!strcmp(argv[1], "-help"))
3636 if (!strcmp(argv[2], "-win_id"))
3642 printf("Invalid argument: %s\n", argv[1]);
3649 printf("Invalid argument: %s\n", argv[1]);
3659 if (!_e_info_client_eldbus_message_with_args("get_fps_info", _cb_fps_info_get,
3663 if (!e_info_client.fps_list)
3666 EINA_LIST_FOREACH(e_info_client.fps_list, l, fps)
3668 if (fps->type == E_INFO_FPS_TYPE_OUTPUT)
3670 printf("%3s-OUTPUT...%3.1f\n",
3674 else if (fps->type == E_INFO_FPS_TYPE_LAYER)
3676 printf("%3s-Layer-ZPos@%d...%3.1f\n",
3681 else if (fps->type == E_INFO_FPS_TYPE_HWC_WIN)
3683 printf("%3s-HWC-Win_ID(0x%x)-ZPos@%d...%3.1f\n",
3689 else if (fps->type == E_INFO_FPS_TYPE_HWC_COMP)
3691 printf("%3s-HWC-COMP...%3.1f\n",
3695 else if (fps->type == E_INFO_FPS_TYPE_CLIENT_WIN)
3697 printf("Client-Win_ID(0x%x)...%3.1f\n",
3703 E_FREE_LIST(e_info_client.fps_list, _e_fps_info_free);
3711 _e_info_client_proc_effect_control(int argc, char **argv)
3717 printf("Error Check Args: enlightenment_info -effect [1: on, 0: off]\n");
3721 onoff = atoi(argv[2]);
3723 if (onoff == 1 || onoff == 0)
3725 if (!_e_info_client_eldbus_message_with_args("effect_control", NULL, "i", onoff))
3727 printf("_e_info_client_eldbus_message_with_args error");
3732 printf("Error Check Args: enlightenment_info -effect [1: on, 0: off]\n");
3736 _e_info_client_quickpanel_control(int argc, char **argv)
3740 Eldbus_Message *msg;
3741 Eldbus_Message_Iter *itr;
3746 printf("Error Check Args: winfo -quickpanel [operation] {window}\n");
3750 operation = atoi(argv[2]);
3756 msg = eldbus_proxy_method_call_new(e_info_client.proxy, "quickpanel_control");
3757 itr = eldbus_message_iter_get(msg);
3758 eldbus_message_iter_basic_append(itr, 'i', operation);
3759 eldbus_message_iter_basic_append(itr, 's', win);
3761 p = eldbus_proxy_send(e_info_client.proxy, msg,
3762 _e_info_client_eldbus_message_cb,
3766 printf("\"aux_msg\" proxy_send error");
3772 _e_info_client_proc_aux_message(int argc, char **argv)
3774 const char *win, *key, *val;
3775 Eldbus_Message *msg;
3776 Eldbus_Message_Iter *itr, *opt_itr;
3782 printf("Error Check Args: enlightenment_info -aux_msg [window] [key] [val] [options]\n");
3790 msg = eldbus_proxy_method_call_new(e_info_client.proxy, "aux_msg");
3791 itr = eldbus_message_iter_get(msg);
3792 eldbus_message_iter_basic_append(itr, 's', win);
3793 eldbus_message_iter_basic_append(itr, 's', key);
3794 eldbus_message_iter_basic_append(itr, 's', val);
3796 opt_itr = eldbus_message_iter_container_new(itr, 'a', "s");
3797 for (i = 5; i < argc; i++)
3798 eldbus_message_iter_basic_append(opt_itr, 's', argv[i]);
3799 eldbus_message_iter_container_close(itr, opt_itr);
3801 p = eldbus_proxy_send(e_info_client.proxy, msg,
3802 _e_info_client_eldbus_message_cb,
3806 printf("\"aux_msg\" proxy_send error");
3810 ecore_main_loop_begin();
3814 _e_info_client_proc_aux_hint(int argc, char **argv)
3816 const char *cmd, *win, *id, *hint, *val;
3817 Eldbus_Message *msg;
3818 Eldbus_Message_Iter *itr;
3823 if ((argc != 5) && (argc != 7))
3833 res = _util_string_to_uint(id, &hint_id, 10);
3836 printf("\"aux_hint\" hint id isn't uint");
3841 if ((argc == 7) && !strncmp(cmd, "add", 3))
3845 msg = eldbus_proxy_method_call_new(e_info_client.proxy, "aux_hint_add");
3846 itr = eldbus_message_iter_get(msg);
3847 eldbus_message_iter_basic_append(itr, 's', win);
3848 eldbus_message_iter_basic_append(itr, 'u', hint_id);
3849 eldbus_message_iter_basic_append(itr, 's', hint);
3850 eldbus_message_iter_basic_append(itr, 's', val);
3852 else if(!strncmp(cmd, "del", 3))
3854 msg = eldbus_proxy_method_call_new(e_info_client.proxy, "aux_hint_del");
3855 itr = eldbus_message_iter_get(msg);
3856 eldbus_message_iter_basic_append(itr, 's', win);
3857 eldbus_message_iter_basic_append(itr, 'u', hint_id);
3865 p = eldbus_proxy_send(e_info_client.proxy, msg,
3866 _e_info_client_eldbus_message_cb,
3870 printf("\"aux_hint\" proxy_send error");
3874 ecore_main_loop_begin();
3878 printf("Error Check Args: enlightenment_info -aux_hint add [window id] [hint id] [hint] [val]\n");
3879 printf(" enlightenment_info -aux_hint del [window id] [hint id]\n");
3885 _e_info_client_cb_scrsaver(const Eldbus_Message *msg)
3887 const char *name = NULL, *text = NULL;
3889 const char *result = NULL;
3891 res = eldbus_message_error_get(msg, &name, &text);
3892 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
3894 res = eldbus_message_arguments_get(msg,
3895 SIGNATURE_SCRSAVER_SERVER,
3897 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
3899 printf("%s\n", result);
3903 if ((name) || (text))
3905 printf("errname:%s errmsg:%s\n", name, text);
3910 _e_info_client_proc_scrsaver(int argc, char **argv)
3912 E_Info_Cmd_Scrsaver cmd = E_INFO_CMD_SCRSAVER_UNKNOWN;
3916 if (eina_streq(argv[2], "info"))
3918 if (argc != 3) goto arg_err;
3919 cmd = E_INFO_CMD_SCRSAVER_INFO;
3921 else if (eina_streq(argv[2], "enable"))
3923 if (argc != 3) goto arg_err;
3924 cmd = E_INFO_CMD_SCRSAVER_ENABLE;
3926 else if (eina_streq(argv[2], "disable"))
3928 if (argc != 3) goto arg_err;
3929 cmd = E_INFO_CMD_SCRSAVER_DISABLE;
3931 else if (eina_streq(argv[2], "timeout"))
3933 if (argc != 4) goto arg_err;
3935 res = _util_string_to_double(argv[3], &sec);
3936 EINA_SAFETY_ON_FALSE_GOTO(res, arg_err);
3938 cmd = E_INFO_CMD_SCRSAVER_TIMEOUT;
3939 printf("sec: %lf\n", sec);
3944 res = _e_info_client_eldbus_message_with_args("scrsaver",
3945 _e_info_client_cb_scrsaver,
3946 SIGNATURE_SCRSAVER_CLIENT,
3948 EINA_SAFETY_ON_FALSE_RETURN(res);
3952 printf("Usage: enlightenment_info -scrsaver %s", USAGE_SCRSAVER);
3956 _e_info_client_proc_force_render(int argc, char **argv)
3958 E_Info_Cmd_Force_Render cmd = E_INFO_CMD_FRENDER_NONE;
3961 if (eina_streq(argv[2], "all"))
3963 if (argc != 3) goto arg_err;
3964 cmd = E_INFO_CMD_FRENDER_ALL;
3966 else if (eina_streq(argv[2], "cls"))
3968 if (argc != 3) goto arg_err;
3969 cmd = E_INFO_CMD_FRENDER_CLS;
3971 else if (eina_streq(argv[2], "canvas"))
3973 if (argc != 3) goto arg_err;
3974 cmd = E_INFO_CMD_FRENDER_CANVAS;
3979 res = _e_info_client_eldbus_message_with_args("frender",
3983 EINA_SAFETY_ON_FALSE_RETURN(res);
3987 printf("Usage: enlightenment_info -frender %s", USAGE_FORCE_RENDER);
3991 #define KILL_USAGE \
3992 "[COMMAND] [ARG]...\n" \
3993 "\t-id : the identifier for the resource whose creator is to be killed.\n" \
3994 "\t-name : the name for the resource whose creator is to be killed.\n" \
3995 "\t-pid : the pid for the resource whose creator is to be killed.\n" \
3996 "\t-pid -f : the pid of the client is going to be killed immediately.\n" \
3997 "\t-all : kill all clients with top level windows\n" \
4000 "\tenlightenment_info -kill\n" \
4001 "\tenlightenment_info -kill [win_id]\n" \
4002 "\tenlightenment_info -kill -id [win_id]\n" \
4003 "\tenlightenment_info -kill -name [win_name]\n" \
4004 "\tenlightenment_info -kill -pid [pid]\n" \
4005 "\tenlightenment_info -kill -pid [pid] -f\n" \
4006 "\tenlightenment_info -kill -all\n" \
4007 "\tenlightenment_info -kill -help\n" \
4010 _e_info_client_proc_screen_rotation_pre(int argc, char **argv)
4016 printf("Error Check Args: enlightenment_info -screen_rotation [0|90|180|270]\n");
4020 rotation_pre = atoi(argv[2]);
4021 if (rotation_pre < 0 || rotation_pre > 360 || rotation_pre % 90)
4023 printf("Error Check Args: enlightenment_info -screen_rotation_pre [0|90|180|270]\n");
4027 if (!_e_info_client_eldbus_message_with_args("screen_rotation_pre", NULL, "i", rotation_pre))
4028 printf("_e_info_client_eldbus_message_with_args error");
4032 _e_info_client_proc_screen_rotation(int argc, char **argv)
4038 printf("Error Check Args: enlightenment_info -screen_rotation [0|90|180|270]\n");
4042 rotation = atoi(argv[2]);
4043 if (rotation < 0 || rotation > 360 || rotation % 90)
4045 printf("Error Check Args: enlightenment_info -screen_rotation [0|90|180|270]\n");
4049 if (!_e_info_client_eldbus_message_with_args("screen_rotation", NULL, "i", rotation))
4050 printf("_e_info_client_eldbus_message_with_args error");
4054 _e_info_client_cb_remote_surface(const Eldbus_Message *msg)
4056 const char *name = NULL, *text = NULL;
4058 Eldbus_Message_Iter *lines;
4059 char *result = NULL;
4061 res = eldbus_message_error_get(msg, &name, &text);
4062 if (res) goto finish;
4064 res = eldbus_message_arguments_get(msg, "as", &lines);
4065 if (!res) goto finish;
4067 while (eldbus_message_iter_get_and_next(lines, 's', &result))
4068 printf("%s\n", result);
4073 if ((name) || (text))
4075 printf("errname:%s errmsg:%s\n", name, text);
4080 _e_info_client_cb_kill_client(const Eldbus_Message *msg)
4082 const char *name = NULL, *text = NULL;
4084 const char *result = NULL;
4085 Eldbus_Message_Iter *array_of_string;
4087 res = eldbus_message_error_get(msg, &name, &text);
4088 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
4090 res = eldbus_message_arguments_get(msg, "a"VALUE_TYPE_REPLY_KILL, &array_of_string);
4091 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4093 while (eldbus_message_iter_get_and_next(array_of_string, 's', &result))
4095 printf("%s\n", result);
4101 if ((name) || (text))
4103 printf("errname:%s errmsg:%s\n", name, text);
4108 _e_info_client_proc_remote_surface(int argc, char **argv)
4112 int dump = -1, query = 0;
4114 if (argc < 3) goto arg_err;
4115 for (i = 2; i < argc; i++)
4117 if (eina_streq(argv[i], "dump"))
4122 dump = atoi(argv[i+1]);
4126 if (eina_streq(argv[i], "info"))
4132 if (dump == -1 && query == 0)
4135 res = _e_info_client_eldbus_message_with_args("remote_surface",
4136 _e_info_client_cb_remote_surface,
4139 EINA_SAFETY_ON_FALSE_RETURN(res);
4142 printf("%s\n", USAGE_REMOTE_SURFACE);
4146 _e_info_client_proc_kill_client(int argc, char **argv)
4148 const static int KILL_ID_MODE = 1;
4149 const static int KILL_NAME_MODE = 2;
4150 const static int KILL_PID_MODE = 3;
4151 const static int KILL_ALL_MODE = 4;
4152 const static int KILL_PID_FORCE_MODE = 5;
4155 unsigned long tmp = 0;
4156 uintptr_t ecore_win = 0;
4157 uint64_t uint64_value = 0;
4158 const char *str_value = "";
4163 mode = KILL_ID_MODE;
4164 printf("Select the window whose client you wish to kill\n");
4165 if (_e_get_window_under_touch(&ecore_win))
4167 printf("Error: cannot get window under touch\n");
4170 uint64_value = (uint64_t)ecore_win;
4174 if (eina_streq(argv[2], "-all"))
4175 mode = KILL_ALL_MODE;
4176 else if (eina_streq(argv[2], "-help"))
4180 mode = KILL_ID_MODE;
4181 if (strlen(argv[2]) >= 2 && argv[2][0] == '0' && argv[2][1] == 'x')
4182 res = _util_string_to_ulong(argv[2], &tmp, 16);
4184 res = _util_string_to_ulong(argv[2], &tmp, 10);
4186 uint64_value = (uint64_t)tmp;
4188 EINA_SAFETY_ON_FALSE_GOTO(res, usage);
4193 if (eina_streq(argv[2], "-id"))
4195 mode = KILL_ID_MODE;
4196 if (strlen(argv[3]) >= 2 && argv[3][0] == '0' && argv[3][1] == 'x')
4197 res = _util_string_to_ulong(argv[3], &tmp, 16);
4199 res = _util_string_to_ulong(argv[3], &tmp, 10);
4201 uint64_value = (uint64_t)tmp;
4203 EINA_SAFETY_ON_FALSE_GOTO(res, usage);
4205 else if (eina_streq(argv[2], "-name"))
4207 mode = KILL_NAME_MODE;
4208 str_value = argv[3];
4210 else if (eina_streq(argv[2], "-pid"))
4212 mode = KILL_PID_MODE;
4213 if (strlen(argv[3]) >= 2 && argv[3][0] == '0' && argv[3][1] == 'x')
4214 res = _util_string_to_ulong(argv[3], &tmp, 16);
4216 res = _util_string_to_ulong(argv[3], &tmp, 10);
4218 uint64_value = (uint64_t)tmp;
4220 EINA_SAFETY_ON_FALSE_GOTO(res, usage);
4227 if (eina_streq(argv[2], "-pid") && eina_streq(argv[4], "-f"))
4229 mode = KILL_PID_FORCE_MODE;
4231 if (strlen(argv[3]) >= 2 && argv[3][0] == '0' && argv[3][1] == 'x')
4232 res = _util_string_to_ulong(argv[3], &tmp, 16);
4234 res = _util_string_to_ulong(argv[3], &tmp, 10);
4236 uint64_value = (uint64_t)tmp;
4237 str_value = argv[4];
4239 EINA_SAFETY_ON_FALSE_GOTO(res, usage);
4245 res = _e_info_client_eldbus_message_with_args("kill_client",
4246 _e_info_client_cb_kill_client,
4247 VALUE_TYPE_REQUEST_FOR_KILL,
4248 mode, uint64_value, str_value);
4249 EINA_SAFETY_ON_FALSE_RETURN(res);
4253 printf("Usage: enlightenment_info %s", KILL_USAGE);
4256 static int window_id_format_dec;
4259 _e_info_client_cb_wininfo(const Eldbus_Message *msg)
4261 const char *name = NULL, *text = NULL;
4263 const char *layer_name;
4264 int x, y, w, h, layer, obscured, opaque, hwc, pl_zpos;
4265 Eina_Bool visible, alpha, iconic, focused, frame_visible, redirected;
4268 int pid, xright, ybelow, border_size;
4270 res = eldbus_message_error_get(msg, &name, &text);
4271 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
4273 res = eldbus_message_arguments_get(msg,
4274 VALUE_TYPE_REPLY_WININFO,
4297 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4299 if (window_id_format_dec)
4300 printf("\n Parent id: %lu\n", (unsigned long)parent_id);
4302 printf("\n Parent id: 0x%lx\n", (unsigned long)parent_id);
4304 printf(" Resource id: %u\n"
4310 " Border size: %d\n"
4317 " Frame visible: %d\n"
4318 " Redirect State: %s\n"
4319 " Layer name: %s\n",
4320 res_id, pid, x, y, w, h, border_size, alpha ? 32 : 24,
4321 focused, opaque, obscured, iconic, visible ? "Visible" : "Not visible",
4322 frame_visible, redirected ? "yes" : "no", layer_name);
4323 if (e_info_client.hwc_windows)
4326 printf(" PL@ZPos:");
4327 if (e_info_client.hwc)
4329 if (e_info_client.hwc_windows) // hwc windows
4333 case E_HWC_WINDOW_STATE_NONE: printf(" NO "); break;
4334 case E_HWC_WINDOW_STATE_CLIENT: printf(" CL "); break;
4335 case E_HWC_WINDOW_STATE_DEVICE: printf(" DV "); break;
4336 case E_HWC_WINDOW_STATE_VIDEO: printf(" VD "); break;
4337 case E_HWC_WINDOW_STATE_CURSOR: printf(" CS "); break;
4338 default: printf(" - "); break;
4345 if ((!iconic) && (frame_visible))
4347 if (pl_zpos == -999)
4351 if (hwc) printf(" hwc@%i\n", pl_zpos);
4352 else printf(" comp@%i\n", pl_zpos);
4369 printf (" Corners: +%d+%d -%d+%d -%d-%d +%d-%d\n",
4370 x, y, xright, y, xright, ybelow, x, ybelow);
4375 if ((name) || (text))
4377 printf("errname:%s errmsg:%s\n", name, text);
4382 _e_info_client_cb_wininfo_tree(const Eldbus_Message *msg)
4384 const char *error_name = NULL, *error_text = NULL;
4388 Eldbus_Message_Iter *array_of_children, *child;
4391 res = eldbus_message_error_get(msg, &error_name, &error_text);
4392 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
4394 res = eldbus_message_arguments_get(msg, VALUE_TYPE_REPLY_WININFO_TREE,
4395 &pwin, &pname, &num_children, &array_of_children);
4396 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4398 if (window_id_format_dec)
4399 printf("\n Parent window id: %lu \"%s\"\n", (unsigned long)pwin, pname);
4401 printf("\n Parent window id: 0x%lx \"%s\"\n", (unsigned long)pwin, pname);
4403 printf (" %d child%s%s\n", num_children, num_children == 1 ? "" : "ren",
4404 num_children ? ":" : ".");
4406 while (eldbus_message_iter_get_and_next(array_of_children, 'r', &child))
4409 const char *child_name;
4410 int x, y, w, h, hwc, pl_zpos, level, j;
4412 res = eldbus_message_iter_arguments_get(child,
4416 &num_children, &level,
4417 &x, &y, &w, &h, &hwc, &pl_zpos);
4418 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4420 for (j = 0; j <= level; j++) printf (" ");
4421 if (window_id_format_dec)
4422 printf("%lu \"%s\":", (unsigned long)child_win, child_name);
4424 printf("0x%lx \"%s\":", (unsigned long)child_win, child_name);
4425 printf (" %dx%d+%d+%d", w, h, x, y);
4426 if (pl_zpos == -999)
4430 if (hwc > 0) printf(" hwc@%i", pl_zpos);
4431 else if (!hwc) printf(" comp@%i", pl_zpos);
4434 if (num_children > 0)
4436 for (j = 0; j <= level + 1; j++) printf (" ");
4437 printf ("%d child%s:\n", num_children, num_children == 1 ? "" : "ren");
4445 if ((error_name) || (error_text))
4447 printf("errname:%s errmsg:%s\n", error_name, error_text);
4452 _e_info_client_cb_wininfo_print_hints(const Eldbus_Message *msg)
4454 const char *name = NULL, *text = NULL;
4456 Eldbus_Message_Iter *array_of_hints;
4460 res = eldbus_message_error_get(msg, &name, &text);
4461 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
4463 res = eldbus_message_arguments_get(msg, "as", &array_of_hints);
4464 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4466 while (eldbus_message_iter_get_and_next(array_of_hints, 's', &hint))
4468 printf(" %s\n", hint);
4473 printf(" No window hints\n");
4475 ecore_main_loop_quit();
4480 if ((name) || (text))
4482 printf("errname:%s errmsg:%s\n", name, text);
4485 ecore_main_loop_quit();
4489 _e_info_client_cb_wininfo_print_shape(const Eldbus_Message *msg)
4491 const char *name = NULL, *text = NULL;
4493 Eldbus_Message_Iter *array_of_shape, *array_of_shape_input;
4494 Eldbus_Message_Iter *struct_of_shape;
4496 int shape_rects_num, shape_input_rects_num;
4498 res = eldbus_message_error_get(msg, &name, &text);
4499 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
4501 res = eldbus_message_arguments_get(msg, "ia(iiii)ia(iiii)",
4502 &shape_rects_num, &array_of_shape,
4503 &shape_input_rects_num, &array_of_shape_input);
4504 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4506 printf(" Number of shape rectangles: %d\n", shape_rects_num);
4507 if (shape_rects_num)
4509 while (eldbus_message_iter_get_and_next(array_of_shape, 'r', &struct_of_shape))
4512 res = eldbus_message_iter_arguments_get(struct_of_shape,
4515 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4517 printf(" %d) x(%d), y(%d), w(%d), h(%d)\n", count, x, y, w, h);
4523 printf(" Number of shape input rectangles: %d\n", shape_input_rects_num);
4524 if (shape_input_rects_num)
4526 while (eldbus_message_iter_get_and_next(array_of_shape_input, 'r', &struct_of_shape))
4529 res = eldbus_message_iter_arguments_get(struct_of_shape,
4532 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4534 printf(" %d) x(%d), y(%d), w(%d), h(%d)\n", count, x, y, w, h);
4539 ecore_main_loop_quit();
4544 if ((name) || (text))
4546 printf("errname:%s errmsg:%s\n", name, text);
4549 ecore_main_loop_quit();
4553 _e_info_client_display_wininfo(uint64_t win, int children, int tree, int stats,
4554 int wm, int size, int shape)
4559 win_name = _e_get_window_name(win);
4560 EINA_SAFETY_ON_NULL_RETURN_VAL(win_name, EINA_FALSE);
4562 if (window_id_format_dec)
4563 printf("\nwininfo: Window id: %lu \"%s\"\n", (unsigned long)win, win_name);
4565 printf("\nwininfo: Window id: 0x%lx \"%s\"\n", (unsigned long)win, win_name);
4569 if (!children && !tree && !wm && !size && !shape)
4572 if ((children || tree))
4574 res = _e_info_client_eldbus_message_with_args("wininfo_tree",
4575 _e_info_client_cb_wininfo_tree,
4576 VALUE_TYPE_REQUEST_FOR_WININFO_TREE,
4578 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
4583 res = _e_info_client_eldbus_message_with_args("wininfo",
4584 _e_info_client_cb_wininfo,
4585 VALUE_TYPE_REQUEST_FOR_WININFO,
4587 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
4592 printf("\nAux_Hint:\n");
4593 res = _e_info_client_eldbus_message_with_args("wininfo_hints",
4594 _e_info_client_cb_wininfo_print_hints,
4597 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
4602 printf("\nSize hints:\n");
4603 res = _e_info_client_eldbus_message_with_args("wininfo_hints",
4604 _e_info_client_cb_wininfo_print_hints,
4607 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
4612 res = _e_info_client_eldbus_message_with_args("wininfo_shape",
4613 _e_info_client_cb_wininfo_print_shape,
4616 EINA_SAFETY_ON_FALSE_RETURN_VAL(res, EINA_FALSE);
4622 #define WININFO_USAGE \
4623 "[-options ...]\n\n" \
4624 "where options include:\n" \
4625 "\t-help : print this message.\n" \
4626 "\t-children : print parent and child identifiers.\n" \
4627 "\t-tree : print children identifiers recursively.\n" \
4628 "\t-stats : print window geometry [DEFAULT]\n" \
4629 "\t-id windowid : use the window with the specified id\n" \
4630 "\t-name windowname : use the window with the specified name\n" \
4631 "\t-pid windowpid : use the window with the specified id\n" \
4632 "\t-int : print window id in decimal\n" \
4633 "\t-size : print size hints\n" \
4634 "\t-wm : print window manager hints\n" \
4635 "\t-shape : print shape rectangles\n" \
4636 "\t-all : -tree, -stats, -wm, -size, -shape\n" \
4638 "\tenlightenment_info -wininfo\n" \
4639 "\tenlightenment_info -wininfo -id [win_id] -all\n" \
4640 "\tenlightenment_info -wininfo -children -stats -size\n" \
4641 "\tenlightenment_info -wininfo -name [win_name] -tree -wm\n" \
4642 "\tenlightenment_info -wininfo -pid [win_pid] -size -shape -int\n" \
4645 _e_info_client_proc_wininfo(int argc, char **argv)
4648 unsigned long tmp = 0;
4649 uintptr_t ecore_win = 0;
4651 int i, children = 0, tree = 0, stats = 0, wm = 0, size = 0, shape = 0;
4652 char *name = NULL, *pid = NULL;
4653 Eina_List *win_list = NULL, *l;
4655 /* Handle our command line arguments */
4656 for (i = 2; i < argc; i++)
4658 if (eina_streq(argv[i], "-help"))
4661 if (eina_streq (argv[i], "-children"))
4667 if (eina_streq(argv[i], "-tree"))
4673 if (eina_streq(argv[i], "-stats"))
4679 if (eina_streq(argv[i], "-id"))
4681 if (++i >= argc || (argv[i][0] < '0' || argv[i][0] > '9'))
4683 printf("Error: -id requires argument\n");
4687 if (strlen(argv[i]) >= 2 && argv[i][0] == '0' && argv[i][1] == 'x')
4688 res = _util_string_to_ulong(argv[i], &tmp, 16);
4690 res = _util_string_to_ulong(argv[i], &tmp, 10);
4692 win = (uint64_t)tmp;
4694 EINA_SAFETY_ON_FALSE_GOTO(res, usage);
4699 if (eina_streq(argv[i], "-name"))
4703 printf("Error: -name requires argument\n");
4711 if (eina_streq(argv[i], "-pid"))
4713 if (++i >= argc || (argv[i][0] < '0' || argv[i][0] > '9'))
4715 printf("Error: -name requires argument\n");
4722 if (eina_streq (argv[i], "-int"))
4724 window_id_format_dec = 1;
4727 if (eina_streq (argv[i], "-wm"))
4732 if (eina_streq (argv[i], "-size"))
4737 if (eina_streq (argv[i], "-shape"))
4742 if (eina_streq (argv[i], "-all"))
4755 if (!win && (name || pid))
4758 win_list = _e_get_windows(_E_GET_WINDOWS_NAME_MODE, name);
4760 win_list = _e_get_windows(_E_GET_WINDOWS_PID_MODE, pid);
4764 printf("Error: cannot get windows\n");
4769 if (!win && !win_list)
4771 printf("Please select the window about which you\n"
4772 "would like information by clicking the\n"
4773 "mouse in that window.\n");
4774 if (_e_get_window_under_touch(&ecore_win))
4776 printf("Error: cannot get window under touch\n");
4779 win = (uint64_t)ecore_win;
4784 res = _e_info_client_display_wininfo(win, children, tree, stats, wm, size, shape);
4785 EINA_SAFETY_ON_FALSE_RETURN(res);
4789 for(l = win_list; l; l = eina_list_next(l))
4793 win = (uint64_t)((Ecore_Window)eina_list_data_get(l));
4794 res = _e_info_client_display_wininfo(win, children, tree, stats, wm, size, shape);
4795 EINA_SAFETY_ON_FALSE_GOTO(res, finish);
4801 eina_list_free(win_list);
4806 printf("Usage: enlightenment_info -wininfo %s", WININFO_USAGE);
4810 _cb_window_proc_version_get(const Eldbus_Message *msg)
4812 const char *name = NULL, *text = NULL;
4816 res = eldbus_message_error_get(msg, &name, &text);
4817 EINA_SAFETY_ON_TRUE_RETURN(res);
4819 res = eldbus_message_arguments_get(msg, "ss", &ver, &rel);
4820 EINA_SAFETY_ON_FALSE_RETURN(res);
4822 printf("Version: %s\n", ver);
4823 printf("Release: %s\n", rel);
4827 _e_info_client_proc_version(int argc, char **argv)
4829 if (!_e_info_client_eldbus_message("get_version", _cb_window_proc_version_get))
4831 printf("_e_info_client_eldbus_message error:%s\n", "get_einfo");
4837 _e_info_client_cb_module_list_get(const Eldbus_Message *msg)
4839 const char *errname = NULL, *errtext = NULL;
4840 Eldbus_Message_Iter *module_array = NULL;
4841 Eldbus_Message_Iter *inner_module_array = NULL;
4842 Eina_Stringshare *module_name = NULL;
4847 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
4850 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "ia(si)", &count, &module_array), err);
4851 printf("============< print module list >===========\n");
4852 printf("module count : %d\n", count);
4853 while (eldbus_message_iter_get_and_next(module_array, 'r', &inner_module_array))
4855 EINA_SAFETY_ON_FALSE_GOTO(
4856 eldbus_message_iter_arguments_get(inner_module_array, "si", &module_name, &onoff),
4858 printf("module [ %30s ]\t:\t%s\n", module_name, onoff?"enabled":"disabled");
4863 if (errname || errtext)
4864 printf("errname : %s, errmsg : %s\n", errname, errtext);
4866 printf("Error occurred in _e_info_client_cb_module_list_get\n");
4873 _e_info_client_cb_module_load(const Eldbus_Message *msg)
4875 const char *errname = NULL, *errtext = NULL;
4876 const char *result = NULL;
4878 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
4880 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
4882 printf("%s\n", result);
4886 if (errname || errtext)
4887 printf("errname : %s, errmsg : %s\n", errname, errtext);
4889 printf("Error occurred in _e_info_client_cb_module_load\n");
4896 _e_info_client_cb_module_unload(const Eldbus_Message *msg)
4898 const char *errname = NULL, *errtext = NULL;
4899 const char *result = NULL;
4901 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
4903 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
4905 printf("%s\n", result);
4909 if (errname || errtext)
4910 printf("errname : %s, errmsg : %s\n", errname, errtext);
4912 printf("Error occurred in _e_info_client_cb_module_unload\n");
4919 _e_info_client_proc_module(int argc, char **argv)
4921 const char *program = argv[0];
4922 const char *command = argv[2];
4923 const char *module_name = argv[3];
4924 Eina_Bool res = EINA_FALSE;
4926 if (((argc < 3) || (argc > 4)))
4931 if (strncmp(command, "list", strlen(command)) == 0)
4936 res = _e_info_client_eldbus_message("module_list_get", _e_info_client_cb_module_list_get);
4938 else if (strncmp(command, "load", strlen(command)) == 0)
4943 res = _e_info_client_eldbus_message_with_args("module_load",
4944 _e_info_client_cb_module_load,
4948 else if (strncmp(command, "unload", strlen(command)) == 0)
4953 res = _e_info_client_eldbus_message_with_args("module_unload",
4954 _e_info_client_cb_module_unload,
4961 EINA_SAFETY_ON_FALSE_GOTO(res, error);
4966 printf("Error occured while send send message\n\n");
4969 printf("Usage : %s -module <command> [<module_name>]\n\n", program);
4970 printf("Commands:\n"
4971 "list : Print the current modules list loaded\n"
4972 "load <module_name> : Load module with the given name\n"
4973 "unload <module_name> : Unload module with the given name\n\n");
4975 "%s -module load e-mod-tizen-effect\n"
4976 "%s -module unload e-mod-tizen-effect\n", program, program);
4981 _e_info_client_cb_shutdown(const Eldbus_Message *msg)
4983 const char *errname = NULL, *errtext = NULL;
4984 const char *result = NULL;
4986 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
4988 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
4990 printf("%s", result);
4994 if(errname || errtext)
4995 printf("errname : %s, errmsg : %s\n", errname, errtext);
4997 printf("Error occurred in _e_info_client_cb_shutdown\n");
5004 _e_info_client_proc_shutdown(int argc, char **argv)
5008 EINA_SAFETY_ON_FALSE_GOTO(argc == 2, usage);
5010 res = _e_info_client_eldbus_message("shutdown", _e_info_client_cb_shutdown);
5011 EINA_SAFETY_ON_FALSE_RETURN(res);
5016 printf("Usage : %s -shutdown\n\n", argv[0]);
5023 _e_info_client_cb_buffer_flush(const Eldbus_Message *msg)
5025 const char *errname = NULL, *errtext = NULL;
5026 const char *result = NULL;
5028 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
5029 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
5031 printf("%s\n", result);
5036 if (errname || errtext)
5038 printf("errname : %s, errmsg : %s\n", errname, errtext);
5042 printf("Error occured in _e_info_client_cb_buffer_flush\n");
5050 _e_info_client_proc_buffer_flush(int argc, char **argv)
5052 unsigned long winid = 0x0;
5053 uint64_t send_winid = 0x0;
5054 Ecore_Window win = 0;
5055 Eina_Bool res = EINA_FALSE;
5057 char *win_name = NULL;
5059 EINA_SAFETY_ON_FALSE_GOTO((argc == 3) || (argc == 4), usage);
5060 EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[2], "on")) ||
5061 (!strcmp(argv[2], "off")) ||
5062 (!strcmp(argv[2], "show")), usage);
5066 // if input has window id, convert to ulong
5067 if (!strcmp(argv[3], "all"))
5069 else if ((strlen(argv[3]) >= 2) && (argv[3][0] == '0') && ((argv[3][1] == 'x') || (argv[3][1] == 'X')))
5070 res = _util_string_to_ulong(argv[3], &winid, 16);
5072 res = _util_string_to_ulong(argv[3], &winid, 10);
5075 printf("error occured while parsing winid: %s\n", argv[3]);
5079 send_winid = (uint64_t) winid;
5082 if (!strcmp(argv[2], "show"))
5087 // get winid from touch
5088 printf("Select the window whose property(ies) you wish to get/set\n");
5089 if (!_e_get_window_under_touch(&win))
5091 win_name = _e_get_window_name(win);
5094 printf("failed to get window under touch\n");
5098 printf("%s %s: window(%s) id : 0x%08zx\n", argv[0], argv[1], win_name, win);
5099 send_winid = (uint64_t) win;
5105 printf("failed to get window under touch\n");
5110 if (!strcmp(argv[2], "on"))
5112 else if (!strcmp(argv[2], "off"))
5118 res = _e_info_client_eldbus_message_with_args("buffer_flush",
5119 _e_info_client_cb_buffer_flush,
5123 EINA_SAFETY_ON_FALSE_GOTO(res, error);
5128 printf("Error occured while send send message\n\n");
5131 printf("Usage : %s %s [on <win_id / all>], [off <win_id / all>], [show <win_id / all>]\n\n"
5132 "\t on : turn on buffer_flush option\n"
5133 "\t off : turn off buffer_flush option\n"
5134 "\t show : show buffer_flush configuration\n",
5136 printf("\n\t %s %s on 0x12345678\n", argv[0], argv[1]);
5137 printf("\t %s %s off all\n", argv[0], argv[1]);
5138 printf("\t %s %s show 0x12345678\n", argv[0], argv[1]);
5144 _e_info_client_cb_deiconify_approve(const Eldbus_Message *msg)
5146 const char *errname = NULL, *errtext = NULL;
5147 const char *result = NULL;
5149 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
5150 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
5152 printf("%s\n", result);
5157 if (errname || errtext)
5159 printf("errname : %s, errmsg : %s\n", errname, errtext);
5163 printf("Error occured in _e_info_client_cb_deiconify_approve\n");
5171 _e_info_client_proc_deiconify_approve(int argc, char **argv)
5173 unsigned long winid = 0x0;
5174 uint64_t send_winid = 0x0;
5175 Ecore_Window win = 0;
5176 Eina_Bool res = EINA_FALSE;
5178 char *win_name = NULL;
5180 EINA_SAFETY_ON_TRUE_GOTO(((argc < 3) || (argc > 4)), usage);
5181 EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[2], "on")) ||
5182 (!strcmp(argv[2], "off")) ||
5183 (!strcmp(argv[2], "show")), usage);
5186 // if input has window id, convert to ulong
5187 if (!strcmp(argv[3], "all"))
5189 else if ((strlen(argv[3]) >= 2) && (argv[3][0] == '0') && ((argv[3][1] == 'x') || (argv[3][1] == 'X')))
5190 res = _util_string_to_ulong(argv[3], &winid, 16);
5192 res = _util_string_to_ulong(argv[3], &winid, 10);
5195 printf("error occured while parsing winid: %s\n", argv[3]);
5199 send_winid = (uint64_t) winid;
5202 if (!strcmp(argv[2], "show"))
5207 // get winid from touch
5208 printf("Select the window whose property(ies) you wish to get/set\n");
5209 if (!_e_get_window_under_touch(&win))
5211 win_name = _e_get_window_name(win);
5214 printf("failed to get window under touch\n");
5218 printf("%s %s: window(%s) id : 0x%08zx\n", argv[0], argv[1], win_name, win);
5219 send_winid = (uint64_t) win;
5225 printf("failed to get window under touch\n");
5230 if (!strcmp(argv[2], "on"))
5232 else if (!strcmp(argv[2], "off"))
5238 res = _e_info_client_eldbus_message_with_args("deiconify_approve",
5239 _e_info_client_cb_deiconify_approve,
5243 EINA_SAFETY_ON_FALSE_GOTO(res, error);
5248 printf("Error occured while send send message\n\n");
5251 printf("Usage : %s %s [on <win_id / all>], [off <win_id / all>], [show <win_id / all>]\n\n"
5252 "\t on : turn on deiconify_approve option\n"
5253 "\t off : turn off deiconify_approve option\n"
5254 "\t show : show deiconify_approve configuration\n",
5256 printf("\n\t %s %s on 0x12345678\n", argv[0], argv[1]);
5257 printf("\t %s %s off all\n", argv[0], argv[1]);
5258 printf("\t %s %s show 0x12345678\n", argv[0], argv[1]);
5264 _e_info_client_proc_key_repeat(int argc, char **argv)
5266 char fd_name[PATH_MAX] = {0,};
5267 int pid, rate = 0, delay = 0;
5269 if (argc == 3 && !strncmp(argv[2], "print", sizeof("print")))
5272 snprintf(fd_name, PATH_MAX, "/proc/%d/fd/1", pid);
5274 else if (argc > 3 && argc < 6 && !strncmp(argv[2], "set", sizeof("set")))
5276 delay = atoi(argv[3]);
5277 if (argc > 4) rate = atoi(argv[4]);
5281 if (!_e_info_client_eldbus_message_with_args("key_repeat", NULL, "sii", fd_name, delay, rate))
5282 printf("Error occured while send message\n");
5287 printf("Usage : %s %s [print], [set <delay> <rate>]\n\n"
5288 "\t print : print current key repeat info\n"
5289 "\t set : set delay and rate (0: do not change this option)\n",
5291 printf("\n\t %s %s print\n", argv[0], argv[1]);
5292 printf("\t %s %s set 400 25\n", argv[0], argv[1]);
5293 printf("\t %s %s set 0 50\n", argv[0], argv[1]);
5297 _e_info_client_memchecker(int argc, char **argv)
5299 if (!_e_info_client_eldbus_message("dump_memchecker", NULL))
5302 printf("e20 dump log file under /tmp dir.\n");
5306 _e_info_client_magnifier(int argc, char **argv)
5312 printf("Error Check Args: enlightenment_info -magnifier [1: on, 0: off]\n");
5316 if (!strncmp(argv[2], "off", sizeof("off"))) op = 0;
5317 else if (!strncmp(argv[2], "on", sizeof("on"))) op = 1;
5318 else if (!strncmp(argv[2], "new", sizeof("new"))) op = 2;
5319 else if (!strncmp(argv[2], "del", sizeof("del"))) op = 3;
5320 else if (!strncmp(argv[2], "set_stand_alone", sizeof("set_stand_alone"))) op = 4;
5321 else if (!strncmp(argv[2], "unset_stand_alone", sizeof("unset_stand_alone"))) op = 5;
5322 else if (!strncmp(argv[2], "show", sizeof("show"))) op = 6;
5323 else if (!strncmp(argv[2], "hide", sizeof("hide"))) op = 7;
5326 printf("Error Check Args: enlightenment_info -magnifier [on/off]\n");
5330 if (!_e_info_client_eldbus_message_with_args("magnifier", NULL, "i", op))
5331 printf("_e_info_client_eldbus_message_with_args error");
5335 _cb_input_region_get(const Eldbus_Message *msg)
5337 const char *name = NULL, *text = NULL;
5338 Eldbus_Message_Iter *array;
5339 Eldbus_Message_Iter *iter;
5343 res = eldbus_message_error_get(msg, &name, &text);
5344 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
5346 printf("Input region\n");
5348 res = eldbus_message_arguments_get(msg, "a(iiii)", &array);
5351 printf("\tNo Input region\n");
5355 while (eldbus_message_iter_get_and_next(array, 'r', &iter))
5357 int x = 0, y = 0, w = 0, h = 0;
5358 res = eldbus_message_iter_arguments_get(iter,
5366 printf("Failed to get input region info\n");
5370 printf("\t[%d] [(%d, %d), %dx%d]\n", cnt, x, y, w, h);
5372 if (cnt == 0) printf("\tNo Input region\n");
5375 if ((name) || (text))
5377 printf("errname:%s errmsg:%s\n", name, text);
5382 _e_info_client_input_region_usage(void)
5384 printf("\nUsage: \n");
5385 printf("\twinfo -input_region [options] [window_id]\n");
5386 printf("\t\toption: -t: time to show input_regions area (sec)\n");
5387 printf("\t\t -color: color to shwo input_regions area (r, g, b) default: red\n");
5388 printf("\tex> winfo -input_region\n");
5389 printf("\t winfo -input_region -t 2 -color g 0xabc123\n");
5393 _e_info_client_proc_input_region(int argc, char **argv)
5395 const char *win_id = NULL;
5398 char win_temp[64] = {0, };
5401 int color_r = 0, color_g = 0, color_b = 0;
5408 if (argv[idx][0] == '-')
5410 if (argv[idx][1] == 't')
5416 printf("Please input correct options\n");
5417 _e_info_client_input_region_usage();
5420 time = atoi(argv[idx]);
5422 else if (!strncmp(argv[idx], "-color", sizeof("-color")))
5428 printf("Please input correct options\n");
5429 _e_info_client_input_region_usage();
5432 if (argv[idx][0] == 'r')
5436 else if (argv[idx][0] == 'g')
5440 else if (argv[idx][0] == 'b')
5446 else if (strstr(argv[idx], "0x"))
5450 else if (!strncmp(argv[idx], "help", sizeof("help")))
5452 _e_info_client_input_region_usage();
5461 printf("Select the window whose input_regions you wish to show\n");
5462 printf("If you want to see more option, please input \"help\" > winfo -input_region help\n");
5463 if (_e_get_window_under_touch(&win))
5465 printf("Error: cannot get window under touch\n");
5469 snprintf(win_temp, sizeof(win_temp), "%lu", (unsigned long int)win);
5473 if (!color_r && !color_g && !color_b)
5476 if (!_e_info_client_eldbus_message_with_args("input_region", _cb_input_region_get, "siiii", win_id, time, color_r, color_g, color_b))
5477 printf("Error occured while send message\n");
5483 _cb_hwc_wins_info_get(const Eldbus_Message *msg)
5485 const char *name = NULL, *text = NULL;
5487 Eldbus_Message_Iter *lines;
5488 char *result = NULL;
5490 res = eldbus_message_error_get(msg, &name, &text);
5491 if (res) goto finish;
5493 res = eldbus_message_arguments_get(msg, "as", &lines);
5494 if (!res) goto finish;
5496 while (eldbus_message_iter_get_and_next(lines, 's', &result))
5497 printf("%s\n", result);
5502 if ((name) || (text))
5504 printf("errname:%s errmsg:%s\n", name, text);
5509 _e_info_client_proc_hwc_wins(int argc, char **argv)
5512 E_Hwc_Wins_Debug_Cmd cmd;
5515 cmd = E_HWC_WINS_DEBUG_CMD_VIS;
5519 cmd = E_HWC_WINS_DEBUG_CMD_VIS;
5520 else if (eina_streq(argv[2], "all"))
5521 cmd = E_HWC_WINS_DEBUG_CMD_ALL;
5522 else if (eina_streq(argv[2], "dv"))
5523 cmd = E_HWC_WINS_DEBUG_CMD_DV;
5524 else if (eina_streq(argv[2], "cl"))
5525 cmd = E_HWC_WINS_DEBUG_CMD_CL;
5526 else if (eina_streq(argv[2], "cs"))
5527 cmd = E_HWC_WINS_DEBUG_CMD_CS;
5528 else if (eina_streq(argv[2], "vd"))
5529 cmd = E_HWC_WINS_DEBUG_CMD_VD;
5530 else if (eina_streq(argv[2], "no"))
5531 cmd = E_HWC_WINS_DEBUG_CMD_NO;
5532 else if (eina_streq(argv[2], "queue"))
5533 cmd = E_HWC_WINS_DEBUG_CMD_QUEUE;
5534 else if (eina_streq(argv[2], "commit"))
5535 cmd = E_HWC_WINS_DEBUG_CMD_COMMIT;
5536 else if (eina_streq(argv[2], "help") || eina_streq(argv[2], "usage"))
5542 res = _e_info_client_eldbus_message_with_args("hwc_wins", _cb_hwc_wins_info_get, "i", cmd);
5544 EINA_SAFETY_ON_FALSE_RETURN(res);
5549 printf("Usage: wininfo_info %s", USAGE_HWC_WINS);
5555 _cb_screen_info_get(const Eldbus_Message *msg)
5557 const char *name = NULL, *text = NULL;
5559 Eldbus_Message_Iter *lines;
5560 char *result = NULL;
5562 res = eldbus_message_error_get(msg, &name, &text);
5563 if (res) goto finish;
5565 res = eldbus_message_arguments_get(msg, "as", &lines);
5566 if (!res) goto finish;
5568 while (eldbus_message_iter_get_and_next(lines, 's', &result))
5569 printf("%s\n", result);
5574 if ((name) || (text))
5576 printf("errname:%s errmsg:%s\n", name, text);
5581 _e_info_client_proc_screen_info(int argc, char **argv)
5584 int dummy_value = 1;
5586 res = _e_info_client_eldbus_message_with_args("screen_info", _cb_screen_info_get, "i", dummy_value);
5588 EINA_SAFETY_ON_FALSE_RETURN(res);
5594 _e_info_client_cb_focus_policy_ext(const Eldbus_Message *msg)
5596 const char *errname = NULL, *errtext = NULL;
5597 Eina_Bool changed = EINA_FALSE;
5600 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
5601 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "bi", &changed, &result), err);
5604 printf("Successfully changed, now focus_policy_ext=%d\n", result);
5605 else if (result >= 0)
5606 printf("now focus_policy_ext=%d\n", result);
5608 printf("Error occured\n");
5613 if(errname || errtext)
5614 printf("errname : %s, errmsg : %s\n", errname, errtext);
5616 printf("Error occurred in _e_info_client_cb_focus_policy_ext\n");
5622 _e_info_client_proc_focus_policy_ext(int argc, char **argv)
5627 EINA_SAFETY_ON_FALSE_GOTO(((argc == 2) || (argc == 3)), usage);
5631 input = atoi(argv[2]);
5632 if ((input != 0) && (input != 1)) goto usage;
5637 res = _e_info_client_eldbus_message_with_args("focus_policy_ext_set", _e_info_client_cb_focus_policy_ext, "i", input);
5638 EINA_SAFETY_ON_FALSE_RETURN(res);
5643 printf("Usage : %s -focus_policy_ext [policy_enum]\n\n", argv[0]);
5644 printf(" %s -focus_policy_ext 0 : set focus_policy_ext to E_FOCUS_EXT_TOP_STACK\n", argv[0]);
5645 printf(" %s -focus_policy_ext 1 : set focus_policy_ext to E_FOCUS_EXT_HISTORY\n", argv[0]);
5646 printf(" %s -focus_policy_ext : show now focus_policy_ext\n", argv[0]);
5652 _e_info_client_cb_focus_history(const Eldbus_Message *msg)
5654 const char *errname = NULL, *errtext = NULL;
5655 Eldbus_Message_Iter *array = NULL, *iter = NULL;
5656 Eina_Bool res = EINA_FALSE;
5659 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
5660 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "a(ubbbs)", &array), err);
5664 printf("---------------------------------[ focus history ]----------------------------------\n");
5665 printf(" No Win_ID focused focusable focus_skip title\n");
5666 printf("------------------------------------------------------------------------------------\n");
5667 while (eldbus_message_iter_get_and_next(array, 'r', &iter))
5669 Eina_Bool focused, focusable, skiped;
5673 res = eldbus_message_iter_arguments_get(iter, "ubbbs", &id, &focused, &focusable, &skiped, &title);
5676 printf("Failed to get focus stack\n");
5680 printf(" %2u 0x%08zx %c %c %c %-20s\n",
5681 i++, id, focused? 'O':' ', focusable? 'O':'X', skiped? 'O':' ', title);
5682 printf("------------------------------------------------------------------------------------\n");
5691 if(errname || errtext)
5692 printf("errname : %s, errmsg : %s\n", errname, errtext);
5694 printf("Error occurred in _e_info_client_cb_focus_history\n");
5700 _e_info_client_proc_focus_history(int argc, char **argv)
5702 EINA_SAFETY_ON_FALSE_GOTO(argc == 2, usage);
5705 res = _e_info_client_eldbus_message("focus_history", _e_info_client_cb_focus_history);
5706 EINA_SAFETY_ON_FALSE_RETURN(res);
5711 printf("Usage : %s -focus_history\n\n", argv[0]);
5717 _e_info_client_proc_screen_record(int argc, char **argv)
5719 e_info_client_screen_recorder_run(argc, argv);
5723 _e_info_client_inputgen_usage(void)
5725 printf(" If you want to generate input events, follow below steps\n");
5726 printf(" \tinit_device -> generate events (keygen) -> deinit_device\n");
5728 printf(" enlightenment_info -init_device\n");
5729 printf(" \t--node: open a device node (ex> /dev/input/event1)\n");
5730 printf(" \t--type: create a device by given type (keyboard/mouse/touch)\n");
5731 printf(" \t\tyou can select one or more types, but currently only keyboard type is supported\n");
5732 printf(" \t--name: device name want to create. used with --type option (default: E_Info_Device)\n");
5734 printf(" you need to choice either node or type to init device\n");
5735 printf(" example> enlightenment_info -init_device --node=/dev/input/event1\n");
5736 printf(" enlightenment_info -init_device --type=keyboard/mouse --name=Test_Device\n");
5737 printf(" enlightenment_info -init_device --type=keyboard\n");
5739 printf(" enlightenment_info -deinit_device\n");
5740 printf(" example> enlightenment_info -deinit_device\n");
5742 printf(" enlightenment_info -keygen\n");
5743 printf(" \t--name: keyname want to generate\n");
5744 printf(" \t--code: X keycode want to generate\n");
5745 printf(" \t--state: key event state want to generate [press/down/1] [release/up/0] (default: Press/Release pair)\n");
5747 printf(" you need to choice either name or code to generate key events\n");
5748 printf(" example> enlightenment_info -keygen --name=XF86Back\n");
5749 printf(" enlightenment_info -keygen --code=166 --state=down\n");
5750 printf(" enlightenment_info -keygen --name=XF86Back --state=0\n");
5752 printf(" enlightenment_info -touchgen\n");
5753 printf(" \t--idx: touch index want to generate (default: 0)\n");
5754 printf(" \t--axis: touch axis want to generate\n");
5755 printf(" \t--state: touch event state want to generate [press/down/1] [release/up/0] [motion/move/2] (default: Press/Motion/Release pair)\n");
5757 printf(" you need to input axis information to generate touch events\n");
5758 printf(" example> enlightenment_info -touchgen --axis=100,200\n");
5759 printf(" enlightenment_info -touchgen --idx=1 --axis=200,300\n");
5760 printf(" enlightenment_info -touchgen --idx=0 --axis=300,100 --state=down\n");
5762 printf(" enlightenment_info -mousegen\n");
5763 printf(" \t--button: button number want to generate (default: left button(0/272))\n");
5764 printf(" \t\t button number following linux input.h so BTN_LEFT value is 272\n");
5765 printf(" \t\t but to generate button simply support 3 button (0: left, 1: right, 2: middle)\n");
5766 printf(" \t\t you can use --btn instead\n");
5767 printf(" \t--axis: mouse relative axis want to generate\n");
5768 printf(" \t--state: mouse event state want to generate [press/down/1] [release/up/0] [motion/move/2] (default: Motion or Press/Release pair)\n");
5769 printf(" \t\t if you add option --axis, default state is move, but if you add option --button, default state is down/up pair\n");
5770 printf(" \t--wheel: mouse wheel event want to generate\n");
5771 printf(" \t--hwheel: mouse horizental wheel event want to generate\n");
5773 printf(" you need to choice either axis or button to generate mouse events\n");
5774 printf(" example> enlightenment_info -mousegen --axis=5,-10 --state=move\n");
5775 printf(" enlightenment_info -mousegen --axis=-12,20\n");
5776 printf(" enlightenment_info -mousegen --button=0 --state=down\n");
5777 printf(" enlightenment_info -mousegen --btn=1\n");
5778 printf(" enlightenment_info -mousegen --wheel=1\n");
5779 printf(" enlightenment_info -mousegen --hwheel=-1\n");
5781 printf(" enlightenment_info -mouse_accel\n");
5782 printf(" \t--state: set mouse acceleration usage [off/0][on/1] (default: on)\n");
5783 printf(" example> enlightenment_info -mouse_accel --state=0\n");
5785 printf(" enlightenment_info -input_log_enable [0/1]\n");
5786 printf(" \t : set input_log_enable [off/0][on/1] (default: on)\n");
5787 printf(" example> enlightenment_info -input_log_enable 1\n");
5789 printf(" enlightenment_info -use_cursor_timer [0/1]\n");
5790 printf(" \t : set use_cursor_timer [off/0][on/1]\n");
5791 printf(" example> enlightenment_info -use_cursor_timer 1\n");
5796 _e_info_client_cb_init_device(const Eldbus_Message *msg)
5798 const char *errname = NULL, *errtext = NULL;
5799 char *result = NULL;
5801 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
5803 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
5805 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
5806 printf("Init_device Failed: %s\n", result);
5811 if(errname || errtext)
5812 printf("errname : %s, errmsg : %s\n", errname, errtext);
5814 printf("Error occurred in _e_info_client_cb_init_device\n");
5818 _e_info_client_proc_init_device(int argc, char **argv)
5820 char name[80] = {0, }, node[20] = {0, };
5821 unsigned int type = 0x0;
5822 char *tmp = NULL, *buf = NULL, *buf_ptr = NULL;
5827 _e_info_client_inputgen_usage();
5831 for (i = 2; i < argc; i++)
5833 if (!strncmp(argv[i], "--node=", sizeof("--node=") - 1))
5835 tmp = argv[i] + sizeof("--node=") - 1;
5836 if (strlen(tmp) > sizeof(node))
5838 printf("Please input correct device node. The length should be less than 20\n");
5841 strncpy(node, tmp, sizeof(node) - 1);
5845 else if (!strncmp(argv[i], "--type=", sizeof("--type=") - 1))
5847 tmp = argv[i] + sizeof("--type=") - 1;
5848 buf = strtok_r(tmp, "/", &buf_ptr);
5851 printf("Please insert correct device type. keyboard/mouse/touch.\n");
5856 if (!strncmp(buf, "mouse", sizeof("mouse")) ||
5857 !strncmp(buf, "pointer", sizeof("pointer")))
5859 type |= E_INPUT_SEAT_POINTER;
5861 else if (!strncmp(buf, "touch", sizeof("touch")))
5863 type |= E_INPUT_SEAT_TOUCH;
5865 else if (!strncmp(buf, "keyboard", sizeof("keyboard")))
5867 type |= E_INPUT_SEAT_KEYBOARD;
5871 printf("Please insert valid device type. keyboard/mouse/touch.\n");
5874 buf = strtok_r(NULL, "/", &buf_ptr);
5877 else if (!strncmp(argv[i], "--name=", sizeof("--name=") - 1))
5879 tmp = argv[i] + sizeof("--name=") - 1;
5880 if (strlen(tmp) > sizeof(name))
5882 printf("Please iuput correct device name. The length should be less than 80\n");
5885 strncpy(name, tmp, sizeof(name) - 1);
5889 _e_info_client_inputgen_usage();
5894 if (!type && node[0] == '\0')
5896 printf("Please insert either node or type\n");
5899 else if (type && node[0] != '\0')
5901 printf("Please insert only one between node and type\n");
5907 if (name[0] == '\0')
5908 snprintf(name, sizeof(name), "E_Info_Device");
5912 snprintf(name, sizeof(name), "%s", node);
5915 if (!_e_info_client_eldbus_message_with_args("init_device", _e_info_client_cb_init_device, "us", type, name))
5920 _e_info_client_proc_deinit_device(int argc, char **argv)
5922 if (!_e_info_client_eldbus_message("deinit_device", NULL))
5927 _e_info_client_cb_keygen(const Eldbus_Message *msg)
5929 const char *errname = NULL, *errtext = NULL;
5930 char *result = NULL;
5932 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
5934 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
5936 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
5937 printf("Keygen Failed: %s\n", result);
5942 if(errname || errtext)
5943 printf("errname : %s, errmsg : %s\n", errname, errtext);
5945 printf("Error occurred in _e_info_client_cb_keygen\n");
5949 _e_info_client_proc_keygen(int argc, char **argv)
5951 char name[16] = {0, };
5952 int state = E_INFO_EVENT_STATE_ALL, code = 0, i;
5957 _e_info_client_inputgen_usage();
5961 for (i = 2; i < argc; i++)
5963 if (!strncmp(argv[i], "--name=", sizeof("--name=") - 1))
5965 tmp = argv[i] + sizeof("--name=") - 1;
5967 if (strlen(tmp) > sizeof(name))
5969 printf("Please input correct keyname. The length should be less than 16\n");
5972 strncpy(name, tmp, sizeof(name) - 1);
5974 else if (!strncmp(argv[i], "--code=", sizeof("--code=") - 1))
5976 tmp = argv[i] + sizeof("--code=") - 1;
5979 else if (!strncmp(argv[i], "--state=", sizeof("--state=") - 1))
5981 tmp = argv[i] + sizeof("--state=") - 1;
5982 if (!strncmp(tmp, "press", sizeof("press")) ||
5983 !strncmp(tmp, "down", sizeof("down")) ||
5984 !strncmp(tmp, "1", sizeof("1")))
5986 state = E_INFO_EVENT_STATE_PRESS;
5988 else if (!strncmp(tmp, "release", sizeof("release")) ||
5989 !strncmp(tmp, "up", sizeof("up")) ||
5990 !strncmp(tmp, "0", sizeof("0")))
5992 state = E_INFO_EVENT_STATE_RELEASE;
5996 printf("Please input correct key state (press/down/1) or (release/up/0)\n");
6002 _e_info_client_inputgen_usage();
6007 if (!code && name[0] == '\0')
6009 printf("Please insert either name or code\n");
6012 else if (code && name[0] != '\0')
6014 printf("Please insert only one between name and code\n");
6018 if (!_e_info_client_eldbus_message_with_args("keygen", _e_info_client_cb_keygen, "sii", name, code, state))
6023 _e_info_client_cb_touchgen(const Eldbus_Message *msg)
6025 const char *errname = NULL, *errtext = NULL;
6026 char *result = NULL;
6028 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
6030 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
6032 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
6033 printf("Touchgen Failed: %s\n", result);
6038 if(errname || errtext)
6039 printf("errname : %s, errmsg : %s\n", errname, errtext);
6041 printf("Error occurred in _e_info_client_cb_touchgen\n");
6045 _e_info_client_proc_touchgen(int argc, char **argv)
6047 int state = E_INFO_EVENT_STATE_ALL, idx = 0, x = -1, y = -1, cnt = 0, i;
6048 char *tmp = NULL, *buf = NULL, *buf_ptr = NULL;
6052 _e_info_client_inputgen_usage();
6056 for (i = 2; i < argc; i++)
6058 if (!strncmp(argv[i], "--idx=", sizeof("--idx=") - 1))
6060 tmp = argv[i] + sizeof("--idx=") - 1;
6063 else if (!strncmp(argv[i], "--axis=", sizeof("--axis=") - 1))
6065 tmp = argv[i] + sizeof("--axis=") - 1;
6066 buf = strtok_r(tmp, ",", &buf_ptr);
6069 printf("Please insert correct axis. --axis=100,200\n");
6074 if (cnt == 0) x = atoi(buf);
6075 else if (cnt == 1) y = atoi(buf);
6078 printf("Please insert valid axis. --axis=100,200\n");
6081 buf = strtok_r(NULL, ",", &buf_ptr);
6085 else if (!strncmp(argv[i], "--state=", sizeof("--state=") - 1))
6087 tmp = argv[i] + sizeof("--state=") - 1;
6088 if (!strncmp(tmp, "press", sizeof("press")) ||
6089 !strncmp(tmp, "down", sizeof("down")) ||
6090 !strncmp(tmp, "1", sizeof("1")))
6092 state = E_INFO_EVENT_STATE_PRESS;
6094 else if (!strncmp(tmp, "release", sizeof("release")) ||
6095 !strncmp(tmp, "up", sizeof("up")) ||
6096 !strncmp(tmp, "0", sizeof("0")))
6098 state = E_INFO_EVENT_STATE_RELEASE;
6100 else if (!strncmp(tmp, "motion", sizeof("motion")) ||
6101 !strncmp(tmp, "move", sizeof("move")) ||
6102 !strncmp(tmp, "2", sizeof("2")))
6104 state = E_INFO_EVENT_STATE_MOTION;
6108 printf("Please input correct key state (press/down/1) or (release/up/0)\n");
6114 _e_info_client_inputgen_usage();
6119 if ((x < 0) || (y < 0))
6121 printf("Please insert correct axis values (greater than 0)\n");
6125 if (!_e_info_client_eldbus_message_with_args("touchgen", _e_info_client_cb_touchgen, "iiii", idx, x, y, state))
6130 _e_info_client_cb_mousegen(const Eldbus_Message *msg)
6132 const char *errname = NULL, *errtext = NULL;
6133 char *result = NULL;
6135 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
6137 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
6139 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
6140 printf("Mousegen Failed: %s\n", result);
6145 if(errname || errtext)
6146 printf("errname : %s, errmsg : %s\n", errname, errtext);
6148 printf("Error occurred in _e_info_client_cb_mousegen\n");
6152 _e_info_client_proc_mousegen(int argc, char **argv)
6154 int state = E_INFO_EVENT_STATE_ALL, button = 0, x = -1, y = -1, cnt = 0, i;
6155 char *tmp = NULL, *buf = NULL, *buf_ptr = NULL;
6159 _e_info_client_inputgen_usage();
6163 for (i = 2; i < argc; i++)
6165 if (!strncmp(argv[i], "--button=", sizeof("--button=") - 1))
6167 tmp = argv[i] + sizeof("--button=") - 1;
6170 else if (!strncmp(argv[i], "--btn=", sizeof("--btn=") - 1))
6172 tmp = argv[i] + sizeof("--btn=") - 1;
6175 else if (!strncmp(argv[i], "--axis=", sizeof("--axis=") - 1))
6177 tmp = argv[i] + sizeof("--axis=") - 1;
6178 buf = strtok_r(tmp, ",", &buf_ptr);
6181 printf("Please insert correct axis. --axis=5,10\n");
6186 if (cnt == 0) x = atoi(buf);
6187 else if (cnt == 1) y = atoi(buf);
6190 printf("Please insert correct axis. --axis=5,10\n");
6193 buf = strtok_r(NULL, ",", &buf_ptr);
6196 state = E_INFO_EVENT_STATE_MOTION;
6198 else if (!strncmp(argv[i], "--state=", sizeof("--state=") - 1))
6200 tmp = argv[i] + sizeof("--state=") - 1;
6201 if (!strncmp(tmp, "press", sizeof("press")) ||
6202 !strncmp(tmp, "down", sizeof("down")) ||
6203 !strncmp(tmp, "1", sizeof("1")))
6205 state = E_INFO_EVENT_STATE_PRESS;
6207 else if (!strncmp(tmp, "release", sizeof("release")) ||
6208 !strncmp(tmp, "up", sizeof("up")) ||
6209 !strncmp(tmp, "0", sizeof("0")))
6211 state = E_INFO_EVENT_STATE_RELEASE;
6213 else if (!strncmp(tmp, "motion", sizeof("motion")) ||
6214 !strncmp(tmp, "move", sizeof("move")) ||
6215 !strncmp(tmp, "2", sizeof("2")))
6217 state = E_INFO_EVENT_STATE_MOTION;
6221 printf("Please input correct mouse state (press/down/1), (release/up/0) or (motion/move/2)\n");
6225 else if (!strncmp(argv[i], "--wheel=", sizeof("--wheel=") - 1))
6227 tmp = argv[i] + sizeof("--wheel=") - 1;
6228 button = E_INFO_BUTTON_WHEEL;
6229 state = E_INFO_EVENT_STATE_MOTION;
6232 else if (!strncmp(argv[i], "--hwheel=", sizeof("--hwheel=") - 1))
6234 tmp = argv[i] + sizeof("--hwheel=") - 1;
6235 button = E_INFO_BUTTON_HWHEEL;
6236 state = E_INFO_EVENT_STATE_MOTION;
6241 _e_info_client_inputgen_usage();
6246 if (state == E_INFO_EVENT_STATE_MOTION && ((x == 0) && (y == 0)))
6248 printf("Please insert correct axis values for motion events\n");
6252 if (!_e_info_client_eldbus_message_with_args("mousegen", _e_info_client_cb_mousegen, "iiii", button, x, y, state))
6257 _e_info_client_cb_mouse_accel(const Eldbus_Message *msg)
6259 const char *errname = NULL, *errtext = NULL;
6260 char *result = NULL;
6262 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
6264 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
6266 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
6267 printf("Mouse_accel Failed: %s\n", result);
6269 printf("Mouse_accel Success\n");
6274 if(errname || errtext)
6275 printf("errname : %s, errmsg : %s\n", errname, errtext);
6277 printf("Error occurred in _e_info_client_cb_mouse_accel\n");
6281 _e_info_client_proc_mouse_accel(int argc, char **argv)
6288 _e_info_client_inputgen_usage();
6292 if (!strncmp(argv[2], "--state=", sizeof("--state=") - 1))
6294 tmp = argv[2] + sizeof("--state=") - 1;
6296 if (!(state == 0 || state == 1))
6298 printf("Please input correct mouse_accel state (off: 0), (on: 1)\n");
6304 _e_info_client_inputgen_usage();
6308 if (!_e_info_client_eldbus_message_with_args("mouse_accel", _e_info_client_cb_mouse_accel, "i", state))
6313 _e_info_client_cb_input_log_enable(const Eldbus_Message *msg)
6315 const char *errname = NULL, *errtext = NULL;
6316 char *result = NULL;
6318 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
6320 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
6322 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
6323 printf("Input_Log_Enable Failed: %s\n", result);
6325 printf("Input_Log_Enable Success\n");
6330 if(errname || errtext)
6331 printf("errname : %s, errmsg : %s\n", errname, errtext);
6333 printf("Error occurred in _e_info_client_cb_input_log_enable\n");
6337 _e_info_client_proc_input_log_enable(int argc, char **argv)
6343 _e_info_client_inputgen_usage();
6347 if (!isdigit(*argv[2]))
6349 printf("Error Check Args: enlightenment_info -input_log_enable [1: on, 0: off]\n");
6353 onoff = atoi(argv[2]);
6355 if (onoff == 0 || onoff == 1)
6357 if (!_e_info_client_eldbus_message_with_args("input_log_enable", _e_info_client_cb_input_log_enable, "i", onoff))
6359 printf("_e_info_client_eldbus_message_with_args error");
6364 printf("Error Check Args: enlightenment_info -input_log_enable [1: on, 0: off]\n");
6368 _e_info_client_cb_use_cursor_timer(const Eldbus_Message *msg)
6370 const char *errname = NULL, *errtext = NULL;
6371 char *result = NULL;
6373 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
6375 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
6377 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
6378 printf("Use_Cursor_Timer Failed: %s\n", result);
6380 printf("Use_Cursor_Timer Success\n");
6385 if(errname || errtext)
6386 printf("errname : %s, errmsg : %s\n", errname, errtext);
6388 printf("Error occurred in _e_info_client_cb_input_log_enable\n");
6392 _e_info_client_proc_use_cursor_timer(int argc, char **argv)
6398 _e_info_client_inputgen_usage();
6402 if (!isdigit(*argv[2]))
6404 printf("Error Check Args: enlightenment_info -use_cursor_timer [1: on, 0: off]\n");
6408 onoff = atoi(argv[2]);
6410 if (onoff == 0 || onoff == 1)
6412 if (!_e_info_client_eldbus_message_with_args("use_cursor_timer", _e_info_client_cb_use_cursor_timer, "i", onoff))
6414 printf("_e_info_client_eldbus_message_with_args error");
6419 printf("Error Check Args: enlightenment_info -use_cursor_timer [1: on, 0: off]\n");
6423 _e_info_client_cb_filter(const Eldbus_Message *msg)
6425 const char *name = NULL, *text = NULL;
6429 res = eldbus_message_error_get(msg, &name, &text);
6430 EINA_SAFETY_ON_TRUE_GOTO(res, finish);
6432 res = eldbus_message_arguments_get(msg, "s", &reply);
6433 printf("%s\n", reply);
6436 if ((name) || (text))
6438 printf("errname:%s errmsg:%s\n", name, text);
6443 _e_info_client_proc_apply_filter(int argc, char **argv)
6445 Eina_Bool res = EINA_FALSE;
6450 //print current filter
6451 res = _e_info_client_eldbus_message_with_args("filter",
6452 _e_info_client_cb_filter,
6456 if (!res) printf("Error occured while sending message\n\n");
6461 EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[2], "blur")) ||
6462 (!strcmp(argv[2], "grayscale")) ||
6463 (!strcmp(argv[2], "inverse_color")), usage);
6464 EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[3], "on")) ||
6465 (!strcmp(argv[3], "off")) ||
6466 (!strcmp(argv[3], "1")) ||
6467 (!strcmp(argv[3], "0")), usage);
6469 if (!strcmp(argv[3], "on") || !strcmp(argv[3], "1")) onoff = 1;
6472 res = _e_info_client_eldbus_message_with_args("filter",
6473 _e_info_client_cb_filter,
6478 if (!res) printf("Error occured while sending message\n\n");
6483 EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[3], "blur")) ||
6484 (!strcmp(argv[3], "grayscale")) ||
6485 (!strcmp(argv[3], "inverse_color")), usage);
6486 EINA_SAFETY_ON_FALSE_GOTO((!strcmp(argv[4], "on")) ||
6487 (!strcmp(argv[4], "off")) ||
6488 (!strcmp(argv[4], "1")) ||
6489 (!strcmp(argv[4], "0")), usage);
6491 if (!strcmp(argv[4], "on") || !strcmp(argv[4], "1")) onoff = 1;
6494 res = _e_info_client_eldbus_message_with_args("filter",
6495 _e_info_client_cb_filter,
6500 if (!res) printf("Error occured while sending message\n\n");
6505 printf("Usage: %s", USAGE_FILTER);
6509 _e_info_client_proc_mtrace(int argc, char **argv)
6515 if ((argv[2][0] != '0' && argv[2][0] != '1'))
6517 printf("Error: invalid argument\n");
6521 enable = atoi(argv[2]);
6522 if (!_e_info_client_eldbus_message_with_args("mtrace", NULL, "i", enable))
6524 printf("_e_info_client_proc_mtrace fail (enable:%d)\n", enable);
6530 printf("Error: invalid argument\n");
6538 _e_info_client_proc_gcov(int argc, char **argv)
6544 if ((argv[2][0] < '0' || argv[2][0] > '1'))
6546 printf("Error: invalid argument\n");
6550 mode = atoi(argv[2]);
6551 if (!_e_info_client_eldbus_message_with_args("gcov", NULL, "i", mode))
6553 printf("_e_info_client_proc_gcov fail (%d)\n", mode);
6559 printf("Error: invalid argument\n");
6567 _e_info_client_basic_operation_gen(int argc, char **argv)
6569 const char *win, *operation;
6570 Eldbus_Message *msg;
6571 Eldbus_Message_Iter *itr;
6576 printf("Error Check Args: enlightenment_info -basic_op_gen [window] [operation]\n");
6581 operation = argv[3];
6583 msg = eldbus_proxy_method_call_new(e_info_client.proxy, "basic_op_gen");
6584 itr = eldbus_message_iter_get(msg);
6585 eldbus_message_iter_basic_append(itr, 's', win);
6586 eldbus_message_iter_basic_append(itr, 's', operation);
6588 p = eldbus_proxy_send(e_info_client.proxy, msg,
6589 _e_info_client_eldbus_message_cb,
6593 printf("\"aux_msg\" proxy_send error");
6597 ecore_main_loop_begin();
6601 _e_info_client_process_info_print(int argc, char **argv)
6607 printf("Error Check Args: enlightenment_info -process_info\n");
6611 res = _e_info_client_eldbus_message("process_info", NULL);
6612 EINA_SAFETY_ON_FALSE_RETURN(res);
6616 _e_info_client_proc_zone_set(int argc, char **argv)
6622 printf("Error Check Args: enlightenment_info -zone_set [windowID] [zone id]\n");
6626 zone_id = atoi(argv[3]);
6628 if (!_e_info_client_eldbus_message_with_args("zone_set", NULL, "si",
6631 printf("_e_info_client_eldbus_message_with_args error");
6637 _e_info_client_proc_input_output_set(int argc, char **argv)
6641 printf("Error Check Args: -input_output_set [input(ex./dev/input/eventX)] [output(ex.HDMIA-1)]\n");
6645 if (!_e_info_client_eldbus_message_with_args("input_output_set", NULL, "ss",
6648 printf("_e_info_client_eldbus_message_with_args error");
6654 _e_info_client_proc_input_seat_set(int argc, char **argv)
6658 printf("Error Check Args: -input_seat_set [input(ex./dev/input/eventX)] [seat(ex.seat-bluetooth)]\n");
6662 if (!_e_info_client_eldbus_message_with_args("input_seat_set", NULL, "ss",
6665 printf("_e_info_client_eldbus_message_with_args error");
6671 _e_info_client_proc_resize_ppu_set(int argc, char **argv)
6677 printf("Error Check Args: enlightenment_info -resize_ppu window_ID value[0~32]\n");
6681 ppu = atoi(argv[3]);
6683 if (!_e_info_client_eldbus_message_with_args("resize_ppu_set", NULL, "si", argv[2], ppu))
6685 printf("_e_info_client_eldbus_message_with_args error");
6691 _e_info_client_property_set(int argc, char **argv)
6693 const char *win, *property;
6698 printf("Error Check Args: winfo -prop_set [window] [property] [value]\n");
6704 set = atoi(argv[4]);
6706 if (!_e_info_client_eldbus_message_with_args("prop_set", NULL, "ssi", win, property, set))
6708 printf("_e_info_client_eldbus_message_with_args error");
6714 _e_info_client_cb_input_subtype_set(const Eldbus_Message *msg)
6716 const char *errname = NULL, *errtext = NULL;
6717 char *result = NULL;
6719 EINA_SAFETY_ON_TRUE_GOTO(eldbus_message_error_get(msg, &errname, &errtext), err);
6721 EINA_SAFETY_ON_FALSE_GOTO(eldbus_message_arguments_get(msg, "s", &result), err);
6723 if (strncmp(result, E_INFO_INPUT_RESULT_NONE, sizeof(E_INFO_INPUT_RESULT_NONE)))
6724 printf("Input_Subtype_Set Failed: %s\n", result);
6726 printf("Input_Subtype_Set Success\n");
6731 if(errname || errtext)
6732 printf("errname : %s, errmsg : %s\n", errname, errtext);
6734 printf("Error occurred in _e_info_client_cb_input_subtype_set\n");
6738 _e_info_client_proc_input_subtype_set(int argc, char **argv)
6742 printf("Error Check Args: -input_subtype_set [input(ex./dev/input/eventX)] [subtype(ex.None/Remocon)]\n");
6746 if (!_e_info_client_eldbus_message_with_args("input_subtype_set", _e_info_client_cb_input_subtype_set, "ss",
6749 printf("_e_info_client_eldbus_message_with_args error");
6755 _e_info_client_proc_kvm_transparent_set(int argc, char **argv)
6760 EINA_SAFETY_ON_FALSE_GOTO(argc == 3, usage);
6762 set = atoi(argv[2]);
6763 if ((set != 0) && (set != 1))
6766 res = _e_info_client_eldbus_message_with_args("kvm_transparent", NULL, "i", set);
6767 EINA_SAFETY_ON_FALSE_RETURN(res);
6772 printf("Usage: %s -kvm_transparent_set [0:unset(opaque), 1:set(transparent)]\n", argv[0]);
6778 typedef struct _ProcInfo
6782 const char *description;
6783 void (*func)(int argc, char **argv);
6786 static ProcInfo procs_to_tracelogs[] =
6791 "Print version of enlightenment",
6792 _e_info_client_proc_version
6795 "protocol_trace", "[console|file_path|disable]",
6796 "Enable/Disable wayland protocol trace",
6797 _e_info_client_proc_protocol_trace
6801 PROTOCOL_RULE_USAGE,
6802 "Add/Remove wayland protocol rule you want to trace",
6803 _e_info_client_proc_protocol_rule
6806 "eina_log_levels", "[mymodule1:5,mymodule2:2]",
6807 "Set EINA_LOG_LEVELS in runtime",
6808 _e_info_client_proc_eina_log_levels
6811 "eina_log_path", "[console|file_path]",
6812 "Set eina-log path in runtime",
6813 _e_info_client_proc_eina_log_path
6819 "Logging using dlog system [on 1, off 0]",
6820 _e_info_client_proc_dlog_switch
6825 "[hwc | exsync] [off: 0, on: 1]",
6826 "Show the trace log in detail",
6827 _e_info_client_proc_trace
6831 static ProcInfo procs_to_printinfo[] =
6835 "Print top visible windows",
6836 _e_info_client_proc_topvwins_info
6840 "Print all windows",
6841 _e_info_client_proc_topwins_info
6844 "compobjs", "[simple]",
6845 "Print detailed information of all composite objects",
6846 _e_info_client_proc_compobjs_info
6850 "Print subsurface information",
6851 _e_info_client_proc_subsurface
6854 "connected_clients", NULL,
6855 "Print connected clients on Enlightenment",
6856 _e_info_client_proc_connected_clients
6861 "Print connected client's resources",
6862 _e_info_client_proc_res_lists
6865 "input_devices", NULL,
6866 "Print connected input devices",
6867 _e_info_client_proc_input_device_info
6871 "[output idx] [mode number]",
6872 "Print output mode info",
6873 _e_info_client_proc_output_mode
6878 "Print state of plane",
6879 _e_info_client_proc_show_plane_state
6882 "show_pending_commit",
6884 "Print state of pending commit",
6885 _e_info_client_proc_show_pending_commit
6890 "Print FPS in every sec per",
6891 _e_info_client_proc_fps_info
6895 "Print a current keymap",
6896 _e_info_client_proc_keymap_info
6899 "keygrab_status", NULL,
6900 "Print a keygrab status",
6901 _e_info_client_proc_keygrab_status
6904 "module_info", NULL,
6905 "Print information maintained by extra modules",
6906 _e_info_client_proc_module_info
6911 "Print information about windows",
6912 _e_info_client_proc_wininfo
6917 "Print input regions",
6918 _e_info_client_proc_input_region
6923 "Print hwc windows information",
6924 _e_info_client_proc_hwc_wins
6929 "Print screen and output information",
6930 _e_info_client_proc_screen_info
6934 static ProcInfo procs_to_execute[] =
6937 "set_force_visible", NULL,
6938 "Show/Hide a composite object",
6939 _e_info_client_proc_force_visible
6944 "Dump window images with options [topvwins, ns]",
6945 _e_info_client_proc_wins_shot
6950 "Get/Set window(s) property(ies)",
6951 _e_info_client_prop_prop_info
6956 "Send a message about rotation",
6957 _e_info_client_proc_rotation
6960 "bgcolor_set", "[<a>,<r>,<g>,<b>]",
6961 "Set the background color of enlightenment canvas",
6962 _e_info_client_proc_bgcolor_set
6966 "[print] [set <delay> <rate>]",
6967 "Print or Set key repeat info",
6968 _e_info_client_proc_key_repeat
6971 "punch", "[on/off] [<X>x<H>+<X>+<Y>] [<a>,<r>,<g>,<b>]",
6972 "HWC should be disabled first with \"-hwc\" option. Punch a UI framebuffer [on/off].",
6973 _e_info_client_proc_punch
6977 "[windowID transform_id enable x y scale_x(percent) scale_y(percent) angle is_bg]",
6978 "Set transform in runtime",
6979 _e_info_client_proc_transform_set
6982 "dump_buffers", DUMP_BUFFERS_USAGE,
6983 "Dump attach buffers [on:1,off:0] (default path:/tmp/dump_xxx/)",
6984 _e_info_client_proc_buffer_shot
6987 "dump_selected_buffers", DUMP_BUFFERS_USAGE,
6988 "Dump Win_ID buffers. Win_ID comed from enlightenment_info -topvwins(default path:/tmp/dump_xxx/)",
6989 _e_info_client_proc_selected_buffer_shot
6992 "dump_screen", "enlightenment_info -dump_screen -p /tmp/ -n xxx.png :make dump /tmp/xxx.png",
6993 "Dump current screen (default path:/tmp/dump_screen.png)",
6994 _e_info_client_proc_screen_shot
6998 "[on: 1, off: 0, 2: info]",
6999 "HW composite policy on(1) and off(0), or prints info(2) via dlog",
7000 _e_info_client_proc_hwc
7005 "Window effect [on 1, off 0]",
7006 _e_info_client_proc_effect_control
7010 USAGE_QUICKPANEL_CONTROL,
7011 "Control quickpanel state",
7012 _e_info_client_quickpanel_control
7016 "[window] [key] [value] [options]",
7017 "Send aux message to client",
7018 _e_info_client_proc_aux_message
7022 "[window] [hint id] [hint] [value]",
7023 "Set aux hint to client",
7024 _e_info_client_proc_aux_hint
7029 "Set parameters of the screen saver",
7030 _e_info_client_proc_scrsaver
7035 "Set geometry or zoom for current desktop",
7036 _e_info_client_proc_desk
7041 "Force render according to parameters",
7042 _e_info_client_proc_force_render
7045 "screen_rotation_pre",
7047 "To rotate screen (pre)",
7048 _e_info_client_proc_screen_rotation_pre
7054 _e_info_client_proc_screen_rotation
7058 USAGE_REMOTE_SURFACE,
7059 "For remote surface debugging",
7060 _e_info_client_proc_remote_surface
7066 _e_info_client_proc_kill_client
7070 "[list], [load <module_name>], [unload <module_name>]",
7071 "Manage modules on enlightenment",
7072 _e_info_client_proc_module
7077 "Shutdown Enlightenment",
7078 _e_info_client_proc_shutdown
7082 "[on <win_id / all>], [off <win_id / all>], [show <win_id / all>]",
7083 "Set buffer_flush configure",
7084 _e_info_client_proc_buffer_flush
7087 "deiconify_approve",
7088 "[on <win_id / all>], [off <win_id / all>], [show <win_id / all>]",
7089 "Set deiconify_approve configure",
7090 _e_info_client_proc_deiconify_approve
7094 "file dumped under /tmp dir.",
7095 "Dump stack information by allocations",
7096 _e_info_client_memchecker
7100 "[enable: 1, disable: 0]",
7101 "enable/disable mtrace",
7102 _e_info_client_proc_mtrace
7107 "On/Off magnifier window",
7108 _e_info_client_magnifier
7113 "set focus_policy_ext, 0 is E_FOCUS_EXT_TOP_STACK, 1 is E_FOCUS_EXT_HISTORY",
7114 _e_info_client_proc_focus_policy_ext
7119 "get focus history",
7120 _e_info_client_proc_focus_history
7123 "dump_video", /* Option */
7124 SCREEN_RECORDER_USAGE,/* Params */
7125 "Recording the screen", /* Description */
7126 _e_info_client_proc_screen_record /* func */
7131 "apply filter option to windows",
7132 _e_info_client_proc_apply_filter
7137 "Get information or Enable/Disable functionality for desk group",
7138 _e_info_client_proc_desk_area
7143 "execute gcov flush",
7144 _e_info_client_proc_gcov
7148 USAGE_BASIC_OPERATION_GENERATE,
7149 "Generate basic operation",
7150 _e_info_client_basic_operation_gen
7155 "Print process information",
7156 _e_info_client_process_info_print
7160 "[windowID zoneID]",
7162 _e_info_client_proc_zone_set
7166 "[input(ex./dev/input/eventX) output(ex.HDMIA-1)]",
7167 "Set input device's output name",
7168 _e_info_client_proc_input_output_set
7172 "[input(ex./dev/input/eventX) seat(ex.seat_bluetooth)]",
7173 "Set input device's seat name",
7174 _e_info_client_proc_input_seat_set
7178 "[windowID ppu_value]",
7179 "Set resize ppu value",
7180 _e_info_client_proc_resize_ppu_set
7185 "Set/Unset specify property",
7186 _e_info_client_property_set
7190 "[0:unset(opaque), 1:set(transparent)]",
7191 "Set/Unset transparent of the kvm service window",
7192 _e_info_client_proc_kvm_transparent_set
7196 ProcInfo procs_to_input[] =
7199 "init_device", /* Option */
7201 "Initialize input device", /* Description */
7202 _e_info_client_proc_init_device /* func */
7205 "deinit_device", /* Option */
7207 "Deinitialize input device", /* Description */
7208 _e_info_client_proc_deinit_device /* func */
7211 "keygen", /* Option */
7213 "Generate key events", /* Description */
7214 _e_info_client_proc_keygen /* func */
7217 "touchgen", /* Option */
7219 "Generate touch events", /* Description */
7220 _e_info_client_proc_touchgen /* func */
7223 "mousegen", /* Option */
7225 "Generate mouse events", /* Description */
7226 _e_info_client_proc_mousegen /* func */
7229 "mouse_accel", /* Option */
7231 "Set mouse acceleration", /* Description */
7232 _e_info_client_proc_mouse_accel /* func */
7235 "input_log_enable", /* Option */
7237 "Set input log enable/disable", /* Description */
7238 _e_info_client_proc_input_log_enable /* func */
7241 "use_cursor_timer", /* Option */
7243 "Set use_cursor_timer enable/disable", /* Description */
7244 _e_info_client_proc_use_cursor_timer /* func */
7247 "input_subtype_set",
7248 "[input(ex./dev/input/eventX) subtype(ex.None/Remocon)]",
7249 "Set input device's subtype(subclas)",
7250 _e_info_client_proc_input_subtype_set
7254 static Eina_List *list_tracelogs = NULL;
7255 static Eina_List *list_printinfo = NULL;
7256 static Eina_List *list_exec= NULL;
7257 static Eina_List *list_input = NULL;
7260 _util_sort_string_cb(const void *data1, const void *data2)
7262 const ProcInfo *info1, *info2;
7263 const char *s1, *s2;
7270 return strncmp(s1, s2, strlen(s2));
7274 _e_info_client_shutdown_list(void)
7276 list_tracelogs = eina_list_free(list_tracelogs);
7277 list_printinfo = eina_list_free(list_printinfo);
7278 list_exec = eina_list_free(list_exec);
7279 list_input = eina_list_free(list_input);
7283 _e_info_client_init_list(void)
7286 list_tracelogs = list_printinfo = list_exec = list_input = NULL;
7288 n_info = sizeof(procs_to_tracelogs) / sizeof(procs_to_tracelogs[0]);
7289 for (i = 0; i < n_info; i++)
7291 list_tracelogs = eina_list_append(list_tracelogs, &procs_to_tracelogs[i]);
7294 n_info = sizeof(procs_to_printinfo) / sizeof(procs_to_printinfo[0]);
7295 for (i = 0; i < n_info; i++)
7297 list_printinfo = eina_list_append(list_printinfo, &procs_to_printinfo[i]);
7299 list_printinfo = eina_list_sort(list_printinfo, eina_list_count(list_printinfo), _util_sort_string_cb);
7301 n_info = sizeof(procs_to_execute) / sizeof(procs_to_execute[0]);
7302 for (i = 0; i < n_info; i++)
7304 list_exec = eina_list_append(list_exec, &procs_to_execute[i]);
7306 list_exec = eina_list_sort(list_exec, eina_list_count(list_exec), _util_sort_string_cb);
7308 n_info = sizeof(procs_to_input) / sizeof(procs_to_input[0]);
7309 for (i = 0; i < n_info; i++)
7311 list_input = eina_list_append(list_input, &procs_to_input[i]);
7313 list_input = eina_list_sort(list_input, eina_list_count(list_input), _util_sort_string_cb);
7317 _e_info_client_eldbus_message_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *p EINA_UNUSED)
7319 E_Info_Message_Cb cb = (E_Info_Message_Cb)data;
7323 ecore_main_loop_quit();
7327 _e_info_client_eldbus_message(const char *method, E_Info_Message_Cb cb)
7331 p = eldbus_proxy_call(e_info_client.proxy, method,
7332 _e_info_client_eldbus_message_cb,
7334 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
7336 ecore_main_loop_begin();
7341 _e_info_client_eldbus_message_with_args(const char *method, E_Info_Message_Cb cb, const char *signature, ...)
7346 va_start(ap, signature);
7347 p = eldbus_proxy_vcall(e_info_client.proxy, method,
7348 _e_info_client_eldbus_message_cb,
7349 cb, -1, signature, ap);
7351 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
7353 ecore_main_loop_begin();
7358 _e_info_client_eldbus_message_with_args_timeout(const char *method, E_Info_Message_Cb cb, double timeout, const char *signature, ...)
7363 va_start(ap, signature);
7364 p = eldbus_proxy_vcall(e_info_client.proxy, method,
7365 _e_info_client_eldbus_message_cb,
7366 cb, timeout, signature, ap);
7368 EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
7370 ecore_main_loop_begin();
7375 _e_info_client_eldbus_disconnect(void)
7377 if (e_info_client.proxy)
7379 eldbus_proxy_unref(e_info_client.proxy);
7380 e_info_client.proxy = NULL;
7383 if (e_info_client.obj)
7385 eldbus_object_unref(e_info_client.obj);
7386 e_info_client.obj = NULL;
7389 if (e_info_client.conn)
7391 eldbus_connection_unref(e_info_client.conn);
7392 e_info_client.conn = NULL;
7395 if (e_info_client.eldbus_init)
7398 e_info_client.eldbus_init = 0;
7403 _e_info_client_eldbus_connect(void)
7405 e_info_client.eldbus_init = eldbus_init();
7406 EINA_SAFETY_ON_FALSE_GOTO(e_info_client.eldbus_init > 0, err);
7408 e_info_client.conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM);
7409 EINA_SAFETY_ON_NULL_GOTO(e_info_client.conn, err);
7411 e_info_client.obj = eldbus_object_get(e_info_client.conn,
7412 "org.enlightenment.wm",
7413 "/org/enlightenment/wm");
7414 EINA_SAFETY_ON_NULL_GOTO(e_info_client.obj, err);
7416 e_info_client.proxy = eldbus_proxy_get(e_info_client.obj, "org.enlightenment.wm.info");
7417 EINA_SAFETY_ON_NULL_GOTO(e_info_client.proxy, err);
7422 _e_info_client_eldbus_disconnect();
7427 _e_info_client_process(int argc, char **argv)
7429 Eina_List *l = NULL;
7430 ProcInfo *procinfo = NULL;
7431 int proc_option_length, argv_len;
7433 signal(SIGINT, end_program);
7434 signal(SIGALRM, end_program);
7435 signal(SIGHUP, end_program);
7436 signal(SIGPIPE, end_program);
7437 signal(SIGQUIT, end_program);
7438 signal(SIGTERM, end_program);
7440 argv_len = strlen(argv[1]+1);
7441 EINA_LIST_FOREACH(list_tracelogs, l, procinfo)
7443 proc_option_length = strlen(procinfo->option);
7444 if (argv_len != proc_option_length) continue;
7445 if (!strncmp(argv[1]+1, procinfo->option, proc_option_length))
7448 procinfo->func(argc, argv);
7454 EINA_LIST_FOREACH(list_printinfo, l, procinfo)
7456 proc_option_length = strlen(procinfo->option);
7457 if (argv_len != proc_option_length) continue;
7458 if (!strncmp(argv[1]+1, procinfo->option, proc_option_length))
7461 procinfo->func(argc, argv);
7467 EINA_LIST_FOREACH(list_exec, l, procinfo)
7469 proc_option_length = strlen(procinfo->option);
7470 if (argv_len != proc_option_length) continue;
7471 if (!strncmp(argv[1]+1, procinfo->option, proc_option_length))
7474 procinfo->func(argc, argv);
7480 EINA_LIST_FOREACH(list_input, l, procinfo)
7482 proc_option_length = strlen(procinfo->option);
7483 if (argv_len != proc_option_length) continue;
7484 if (!strncmp(argv[1]+1, procinfo->option, proc_option_length))
7487 procinfo->func(argc, argv);
7497 _e_info_client_print_usage_all(const char *exec)
7499 Eina_List *l = NULL;
7500 ProcInfo *procinfo = NULL;
7502 printf("\nUsage:\n");
7503 EINA_LIST_FOREACH(list_tracelogs, l, procinfo)
7505 printf(" %s -%s %s\n", exec, procinfo->option, (procinfo->params)?procinfo->params:"");
7508 EINA_LIST_FOREACH(list_printinfo, l, procinfo)
7510 printf(" %s -%s %s\n", exec, procinfo->option, (procinfo->params)?procinfo->params:"");
7513 EINA_LIST_FOREACH(list_exec, l, procinfo)
7515 printf(" %s -%s %s\n", exec, procinfo->option, (procinfo->params)?procinfo->params:"");
7518 EINA_LIST_FOREACH(list_input, l, procinfo)
7520 printf(" %s -%s %s\n", exec, procinfo->option, (procinfo->params)?procinfo->params:"");
7525 _e_info_client_print_usage(int argc, char **argv)
7527 Eina_List *l = NULL;
7528 ProcInfo *procinfo = NULL;
7531 arglen = strlen(argv[1]+1);
7532 EINA_LIST_FOREACH(list_tracelogs, l, procinfo)
7534 optlen = strlen(procinfo->option);
7535 if (arglen != optlen) continue;
7536 if (!strncmp(argv[1]+1, procinfo->option, optlen))
7538 printf(" %s\n\n", (procinfo->description)?procinfo->description:"");
7539 printf(" %s -%s %s\n", argv[0], procinfo->option, (procinfo->params)?procinfo->params:"");
7544 EINA_LIST_FOREACH(list_printinfo, l, procinfo)
7546 optlen = strlen(procinfo->option);
7547 if (arglen != optlen) continue;
7548 if (!strncmp(argv[1]+1, procinfo->option, optlen))
7550 printf(" %s\n\n", (procinfo->description)?procinfo->description:"");
7551 printf(" %s -%s %s\n", argv[0], procinfo->option, (procinfo->params)?procinfo->params:"");
7556 EINA_LIST_FOREACH(list_exec, l, procinfo)
7558 optlen = strlen(procinfo->option);
7559 if (arglen != optlen) continue;
7560 if (!strncmp(argv[1]+1, procinfo->option, optlen))
7562 printf(" %s\n\n", (procinfo->description)?procinfo->description:"");
7563 printf(" %s -%s %s\n", argv[0], procinfo->option, (procinfo->params)?procinfo->params:"");
7568 EINA_LIST_FOREACH(list_input, l, procinfo)
7570 optlen = strlen(procinfo->option);
7571 if (arglen != optlen) continue;
7572 if (!strncmp(argv[1]+1, procinfo->option, optlen))
7574 printf(" %s\n\n", (procinfo->description)?procinfo->description:"");
7575 printf(" %s -%s %s\n", argv[0], procinfo->option, (procinfo->params)?procinfo->params:"");
7585 _e_info_client_print_description(const char *exec)
7587 Eina_List *l = NULL;
7588 ProcInfo *procinfo = NULL;
7592 EINA_LIST_FOREACH(list_tracelogs, l, procinfo)
7594 printf(" -%-30s\t", procinfo->option);
7595 printf(": %s\n", (procinfo->description)?procinfo->description:"");
7598 EINA_LIST_FOREACH(list_printinfo, l, procinfo)
7600 printf(" -%-30s\t", procinfo->option);
7601 printf(": %s\n", (procinfo->description)?procinfo->description:"");
7604 EINA_LIST_FOREACH(list_exec, l, procinfo)
7606 printf(" -%-30s\t", procinfo->option);
7607 printf(": %s\n", (procinfo->description)?procinfo->description:"");
7610 EINA_LIST_FOREACH(list_input, l, procinfo)
7612 printf(" -%-30s\t", procinfo->option);
7613 printf(": %s\n", (procinfo->description)?procinfo->description:"");
7620 end_program(int sig)
7622 ecore_main_loop_quit();
7623 /* disconnecting dbus */
7624 _e_info_client_eldbus_disconnect();
7629 main(int argc, char **argv)
7633 printf("fail eina_init");
7639 printf("fail ecore_init");
7644 /* list up all proc*/
7645 _e_info_client_init_list();
7647 if (argc < 2 || argv[1][0] != '-')
7649 _e_info_client_print_description(argv[0]);
7653 /* connecting dbus */
7654 if (!_e_info_client_eldbus_connect())
7656 printf("fail eldbus connection");
7659 if (!strcmp(argv[1], "-h") ||
7660 !strcmp(argv[1], "-help") ||
7661 !strcmp(argv[1], "--help"))
7663 _e_info_client_print_usage_all(argv[0]);
7665 else if (argc >= 3 &&
7666 (!strcmp(argv[2], "-h") ||
7667 !strcmp(argv[2], "-help") ||
7668 !strcmp(argv[2], "--help")))
7670 _e_info_client_print_usage(argc, argv);
7674 /* handling a client request */
7675 if (!_e_info_client_process(argc, argv))
7677 printf("unknown option: %s\n", argv[1]);
7678 _e_info_client_print_usage(argc, argv);
7683 _e_info_client_shutdown_list();
7685 /* disconnecting dbus */
7686 _e_info_client_eldbus_disconnect();
7691 _e_info_client_shutdown_list();
7692 _e_info_client_eldbus_disconnect();