Revert "change code to use E_EVENT_CLIENT_LAUNCH_REAL_DONE event" 11/322711/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 15 Apr 2025 01:05:48 +0000 (10:05 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Tue, 15 Apr 2025 01:18:15 +0000 (10:18 +0900)
This reverts commit fba95e0134d85484587721a94fb910bac6c7b8b8.

Change-Id: Ibd203a6712a4b0eb269552cbf8ce143fe84c23cf

src/e_mod_processmgr.c

index c0017ac9458b5504d23a9aeb4d41aee8ad0db80b..0b24aa16be50174207f16430486353d82e171421 100644 (file)
@@ -27,6 +27,9 @@ static Eldbus_Message *_e_processmgr_visible_window_info_v2_get(const Eldbus_Ser
 static Eldbus_Message *_e_processmgr_visible_window_info_v3_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);
+
 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 },
@@ -376,27 +379,75 @@ _e_processmgr_focus_pid_get(const Eldbus_Service_Interface *iface EINA_UNUSED, c
    return reply;
 }
 
+static void
+_e_processmgr_cb_launch_done(void *data, Evas_Object *obj, const char *signal, const char *source)
+{
+   E_Client *ec;
+   int pid = -1;
+
+   ec = data;
+   if (!ec) return;
+
+   pid = _process_id_get(ec);
+   if (pid <= 0) return;
+
+   _e_processmgr_process_action_send(pid, E_PROCESS_ACT_LAUNCH);
+}
+
 static Eina_Bool
-_e_processmgr_cb_launch_real_done(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+_e_processmgr_cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
    E_Event_Client *ev;
    E_Client *ec;
-   int pid = -1;
 
    ev = event;
    if (!ev) return ECORE_CALLBACK_PASS_ON;
 
    ec = ev->ec;
-   if (!ec) return ECORE_CALLBACK_PASS_ON;
+   e_comp_object_signal_callback_add(e_client_frame_get(ec),
+                                     "e,action,launch_real,done",
+                                     "e",
+                                     _e_processmgr_cb_launch_done,
+                                     ec);
 
-   pid = _process_id_get(ec);
-   if (pid <= 0) return ECORE_CALLBACK_PASS_ON;
+   return ECORE_CALLBACK_PASS_ON;
+}
 
-   _e_processmgr_process_action_send(pid, E_PROCESS_ACT_LAUNCH);
+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(e_client_frame_get(ec),
+                                          "e,action,launch_real,done",
+                                          "e",
+                                          _e_processmgr_cb_launch_done,
+                                          ec);
 
    return ECORE_CALLBACK_PASS_ON;
 }
 
+static void
+_e_processmgr_cb_client_reuse(void *data EINA_UNUSED, E_Client *ec)
+{
+   e_comp_object_signal_callback_del_full(e_client_frame_get(ec),
+                                          "e,action,launch_real,done",
+                                          "e",
+                                          _e_processmgr_cb_launch_done,
+                                          ec);
+
+   e_comp_object_signal_callback_add(e_client_frame_get(ec),
+                                     "e,action,launch_real,done",
+                                     "e",
+                                     _e_processmgr_cb_launch_done,
+                                     ec);
+}
+
 static Eina_Bool
 _dbus_init(void)
 {
@@ -465,7 +516,10 @@ 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_LAUNCH_REAL_DONE, _e_processmgr_cb_launch_real_done, NULL);
+   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);
+
+   E_COMP_WL_HOOK_APPEND(_e_processmgr_wl_hooks, E_COMP_WL_HOOK_CLIENT_REUSE, _e_processmgr_cb_client_reuse, NULL);
 
    return EINA_TRUE;