#define IFACE "org.enlightenment.wm.proc"
static Eina_List *hooks_ec = NULL;
+static Eina_List *_e_processmgr_ec_handlers = NULL;
Eldbus_Connection *_e_processmgr_conn;
Eldbus_Service_Interface *_e_processmgr_iface;
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 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);
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 },
}
}
+static void
+_e_processmgr_cb_launch_done(void *data, Evas_Object *obj, const char *signal, const char *source)
+{
+ E_Client *ec;
+
+ ec = data;
+ if (!ec) return;
+
+ _e_processmgr_process_action_send(ec->netwm.pid, E_PROCESS_ACT_LAUNCH);
+}
+
+static Eina_Bool
+_e_processmgr_cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ E_Event_Client *ev;
+ E_Client *ec;
+
+ ev = event;
+ if (!ev) return ECORE_CALLBACK_PASS_ON;
+
+ ec = ev->ec;
+ e_comp_object_signal_callback_add(ec->frame,
+ "e,action,launch,done",
+ "e",
+ _e_processmgr_cb_launch_done,
+ ec);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_processmgr_cb_client_remove(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ E_Event_Client *ev;
+ E_Client *ec;
+
+ ev = event;
+ if (!ev) return ECORE_CALLBACK_PASS_ON;
+
+ ec = ev->ec;
+ e_comp_object_signal_callback_del_full(ec->frame,
+ "e,action,launch,done",
+ "e",
+ _e_processmgr_cb_launch_done,
+ ec);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
EAPI Eina_Bool
e_mod_processmgr_init(void)
{
hook = e_process_hook_add(E_PROCESS_HOOK_ACTION_CHANGE, _e_processmgr_cb_hook_action_change, NULL);
if (hook) hooks_ec = eina_list_append(hooks_ec, hook);
+ E_LIST_HANDLER_APPEND(_e_processmgr_ec_handlers, E_EVENT_CLIENT_ADD, _e_processmgr_cb_client_add, NULL);
+ E_LIST_HANDLER_APPEND(_e_processmgr_ec_handlers, E_EVENT_CLIENT_REMOVE, _e_processmgr_cb_client_remove, NULL);
+
return EINA_TRUE;
}
eldbus_shutdown();
+ E_FREE_LIST(_e_processmgr_ec_handlers, ecore_event_handler_del);
EINA_LIST_FREE(hooks_ec, hook)
e_process_hook_del(hook);
}