add code to send E_PROCESS_ACT_LAUNCH signal after launching done 90/112490/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 1 Feb 2017 07:25:31 +0000 (16:25 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 1 Feb 2017 07:25:31 +0000 (16:25 +0900)
Change-Id: I4cc789b52dfecef41ce17a5b06b8629d298a8a71

src/e_mod_processmgr.c

index 67bde45..4c02421 100644 (file)
@@ -5,12 +5,15 @@
 #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 },
@@ -151,6 +154,55 @@ _e_processmgr_dbus_shutdown(void)
      }
 }
 
+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)
 {
@@ -164,6 +216,9 @@ 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;
 }
 
@@ -176,6 +231,7 @@ e_mod_processmgr_shutdown(void)
 
    eldbus_shutdown();
 
+   E_FREE_LIST(_e_processmgr_ec_handlers, ecore_event_handler_del);
    EINA_LIST_FREE(hooks_ec, hook)
      e_process_hook_del(hook);
 }