From: Doyoun Kang Date: Tue, 21 Feb 2017 02:16:26 +0000 (+0900) Subject: add a feature for getting focus pid information X-Git-Tag: submit/tizen/20170221.074644~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e871dbfc8161ea3593542f0ddf3e8d8b4af7e992;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-processmgr.git add a feature for getting focus pid information Change-Id: Ib099c59392986bd9ffb0727f8b465f06c7a924eb --- diff --git a/src/e_mod_processmgr.c b/src/e_mod_processmgr.c index 952ae23..f03cf2e 100644 --- a/src/e_mod_processmgr.c +++ b/src/e_mod_processmgr.c @@ -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) {