return;
}
+static void
+_e_info_client_proc_module_info(int argc, char **argv)
+{
+ char fd_name[PATH_MAX];
+ int pid;
+
+ if (argc != 3 || !argv[2])
+ {
+ printf("Usage> enlightenment_info -module_info [module name]\n");
+ return;
+ }
+
+ pid = getpid();
+
+ snprintf(fd_name, PATH_MAX, "/proc/%d/fd/1", pid);
+
+ if (!_e_info_client_eldbus_message_with_args("get_module_info", NULL, "ss", argv[2], fd_name))
+ return;
+}
+
+static void
+_e_info_client_proc_keygrab_status(int argc, char **argv)
+{
+ char fd_name[PATH_MAX];
+ int pid;
+ char cwd[PATH_MAX];
+
+ if (argc != 3 || !argv[2])
+ {
+ printf("Usage> enlightenment_info -keygrab_status [console | file path]\n");
+ return;
+ }
+
+ pid = getpid();
+
+ cwd[0] = '\0';
+ if (!getcwd(cwd, sizeof(cwd)))
+ snprintf(cwd, sizeof(cwd), "/tmp");
+
+ if (!strncmp(argv[2], "console", sizeof("console")))
+ snprintf(fd_name, PATH_MAX, "/proc/%d/fd/1", pid);
+ else
+ {
+ if (argv[2][0] == '/')
+ snprintf(fd_name, PATH_MAX, "%s", argv[2]);
+ else
+ {
+ if (strlen(cwd) > 0)
+ snprintf(fd_name, PATH_MAX, "%s/%s", cwd, argv[2]);
+ else
+ snprintf(fd_name, PATH_MAX, "%s", argv[2]);
+ }
+ }
+
+ if (!_e_info_client_eldbus_message_with_args("get_keygrab_status", NULL, "s", fd_name))
+ return;
+}
+
static char *
_directory_make(char *path)
{
"[on: 1, off: 0]",
"On/Off the window effect",
_e_info_client_proc_effect_control
+ },
+ {
+ "keygrab_status", NULL,
+ "Print a keygrab status",
+ _e_info_client_proc_keygrab_status
+ },
+ {
+ "module_info", NULL,
+ "Print information maintained by extra modules",
+ _e_info_client_proc_module_info
}
};
//FILE pointer for protocol_trace
static FILE *log_fp_ptrace = NULL;
+// Module list for module info
+static Eina_List *module_hook = NULL;
+
#define BUF_SNPRINTF(fmt, ARG...) do { \
str_l = snprintf(str_buff, str_r, fmt, ##ARG); \
str_buff += str_l; \
return reply;
}
+static void
+_e_info_server_hook_call(const char *module_name, const char *log_path)
+{
+ Eina_List *l;
+ E_Info_Hook *data;
+
+ EINA_LIST_FOREACH(module_hook, l, data)
+ {
+ if (!strncmp(data->module_name, module_name, strlen(module_name)))
+ {
+ data->func(data->data, log_path);
+ break;
+ }
+ }
+}
+
+E_API void
+e_info_server_hook_set(const char *module_name, E_Info_Hook_Cb func, void *data)
+{
+ Eina_List *l, *l_next;
+ E_Info_Hook *hdata, *ndata;
+
+ EINA_SAFETY_ON_NULL_RETURN(module_name);
+
+ EINA_LIST_FOREACH_SAFE(module_hook, l, l_next, hdata)
+ {
+ if (!strncmp(hdata->module_name, module_name, strlen(module_name)))
+ {
+ if (!func)
+ {
+ eina_stringshare_del(hdata->module_name);
+ E_FREE(hdata);
+ module_hook = eina_list_remove_list(module_hook, l);
+ }
+ else
+ {
+ hdata->func = func;
+ hdata->data = data;
+ }
+ return;
+ }
+ }
+
+ ndata = E_NEW(E_Info_Hook, 1);
+ EINA_SAFETY_ON_NULL_RETURN(ndata);
+
+ ndata->module_name = eina_stringshare_add(module_name);
+ ndata->func = func;
+ ndata->data = data;
+
+ module_hook = eina_list_append(module_hook, ndata);
+}
+
+static Eldbus_Message *
+_e_info_server_cb_module_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ const char *path = NULL, *module_name = NULL;
+
+ if (!eldbus_message_arguments_get(msg, "ss", &module_name, &path) || !module_name || !path)
+ {
+ ERR("Error getting arguments.");
+ return reply;
+ }
+
+ _e_info_server_hook_call(module_name, path);
+
+ return reply;
+}
+
+static Eldbus_Message *
+_e_info_server_cb_keygrab_status_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ const char *path = NULL;
+
+ if (!eldbus_message_arguments_get(msg, "s", &path) || !path)
+ {
+ ERR("Error getting arguments.");
+ return reply;
+ }
+
+ _e_info_server_hook_call("keygrab", path);
+
+ return reply;
+}
+
static Eldbus_Message *
_e_info_server_cb_fps_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
#endif
{ "get_keymap", NULL, ELDBUS_ARGS({"hi", "keymap fd"}), _e_info_server_cb_keymap_info_get, 0},
{ "effect_control", ELDBUS_ARGS({"i", "effect_control"}), NULL, e_info_server_cb_effect_control, 0},
+ { "get_keygrab_status", ELDBUS_ARGS({"s", "get_keygrab_status"}), NULL, _e_info_server_cb_keygrab_status_get, 0},
+ { "get_module_info", ELDBUS_ARGS({"ss", "get_module_info"}), NULL, _e_info_server_cb_module_info_get, 0},
{ NULL, NULL, NULL, NULL, 0 }
};