add a feature for getting focus pid information 47/115647/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 21 Feb 2017 02:16:26 +0000 (11:16 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Tue, 21 Feb 2017 02:16:26 +0000 (11:16 +0900)
Change-Id: Ib099c59392986bd9ffb0727f8b465f06c7a924eb

src/e_mod_processmgr.c

index 952ae23..f03cf2e 100644 (file)
@@ -16,6 +16,7 @@ static void _e_processmgr_process_action_send(int pid, E_Process_Action act);
 static void _e_processmgr_cb_hook_action_change(void *d EINA_UNUSED, E_Process *epro, void *user);
 static Eldbus_Message* _e_processmgr_process_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg);
 static Eldbus_Message *_e_processmgr_visible_window_info_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg);
+static Eldbus_Message *_e_processmgr_focus_pid_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg);
 
 static Eina_Bool _e_processmgr_cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
 static Eina_Bool _e_processmgr_cb_client_remove(void *data EINA_UNUSED, int type EINA_UNUSED, void *event);
@@ -23,6 +24,7 @@ static Eina_Bool _e_processmgr_cb_client_remove(void *data EINA_UNUSED, int type
 static const Eldbus_Method _e_processmgr_methods[] = {
    { "GetProcStatus", ELDBUS_ARGS({"i", "pid"}), ELDBUS_ARGS({"i","process status"}, {"i", "focused"}), _e_processmgr_process_info_get, 0 },
    { "GetVisibleWinInfo", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_VISIBLE_WINS")", "array of window"}), _e_processmgr_visible_window_info_get, 0 },
+   { "GetFocusProc", NULL, ELDBUS_ARGS({"i", "pid"}), _e_processmgr_focus_pid_get, 0 },
    { NULL, NULL, NULL, NULL, 0 }
 };
 
@@ -223,6 +225,24 @@ _e_processmgr_visible_window_info_get(const Eldbus_Service_Interface *iface EINA
    return reply;
 }
 
+static Eldbus_Message *
+_e_processmgr_focus_pid_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = NULL;
+   E_Client *ec;
+   int pid = -1;
+
+   reply = eldbus_message_method_return_new(msg);
+
+   ec = e_client_focused_get();
+   if (ec)
+     pid = _process_id_get(ec);
+
+   eldbus_message_arguments_append(reply, "i", pid);
+
+   return reply;
+}
+
 static Eina_Bool
 _e_processmgr_dbus_init(void *data EINA_UNUSED)
 {