From: Doyoun Kang Date: Mon, 22 Feb 2016 04:30:04 +0000 (+0900) Subject: Added code to send ACTIVATE/DEACTIVATE message when the active(focused) process is... X-Git-Tag: submit/tizen/20160222.045547~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=875efea29fe1b38ae6d30e325d89bee77c5b2d40;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-processmgr.git Added code to send ACTIVATE/DEACTIVATE message when the active(focused) process is changed Change-Id: I91b63ffa33efdc7fbfda6fec51fe06ab239a8d4b --- diff --git a/src/e_mod_processmgr.c b/src/e_mod_processmgr.c index 9b350b3..e58af7c 100644 --- a/src/e_mod_processmgr.c +++ b/src/e_mod_processmgr.c @@ -25,6 +25,7 @@ static Eina_Bool _e_processmgr_cb_client_remove(void *data EINA_UNUSED, int type static Eina_Bool _e_processmgr_cb_client_iconify(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); static Eina_Bool _e_processmgr_cb_client_uniconify(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); static Eina_Bool _e_processmgr_cb_client_visibility_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); +static Eina_Bool _e_processmgr_cb_client_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); static void _pol_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec); @@ -212,6 +213,13 @@ _e_processmgr_client_info_del(E_Client *ec) winfo = _e_processmgr_client_info_find(_pm, ec); if (!winfo) return; + if (_pm->active_win == ec) + { + _pm->active_win = NULL; + ELOGF("PROCESSMGR STATE", "PROCESS_DEACTIVATE. PID:%d", NULL, NULL, winfo->pid); + _e_processmgr_send_pid_action(winfo->pid, PROCESS_DEACTIVATE); + } + _e_processmgr_processinfo_del(winfo->pid, ec); eina_hash_del_by_key(_pm->wins_hash, &ec); @@ -233,6 +241,7 @@ _e_processmgr_cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void * if (!ev) return ECORE_CALLBACK_PASS_ON; ec = ev->ec; + _e_processmgr_client_info_add(ec); return ECORE_CALLBACK_PASS_ON; @@ -302,6 +311,61 @@ _e_processmgr_cb_client_visibility_change(void *data EINA_UNUSED, int type EINA_ return ECORE_CALLBACK_PASS_ON; } +static Eina_Bool +_e_processmgr_cb_client_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + E_Event_Client *ev; + E_Client *ec; + E_Client *ec_deactive; + E_WindowInfo *winfo = NULL; + E_WindowInfo *winfo_deactive = NULL; + E_ProcessInfo *pinfo = NULL; + Eina_Bool change_active = EINA_FALSE; + + ev = event; + if (!ev) return ECORE_CALLBACK_PASS_ON; + + ec = ev->ec; + + winfo = _e_processmgr_client_info_find(_pm, ec); + if (!winfo) return EINA_FALSE; + + if (winfo->pid <= 0) return EINA_FALSE; + + pinfo = _e_processmgr_processinfo_find(_pm, winfo->pid); + if (!pinfo) return EINA_FALSE; + + ec_deactive = _pm->active_win; + _pm->active_win = ec; + + winfo_deactive = _e_processmgr_client_info_find(_pm, ec_deactive); + if (!winfo_deactive) + { + change_active = EINA_TRUE; + } + else + { + if (winfo_deactive->pid != winfo->pid) + { + change_active = EINA_TRUE; + } + } + + if (change_active) + { + ELOGF("PROCESSMGR STATE", "PROCESS_ACTIVATE. PID:%d", NULL, NULL, winfo->pid); + _e_processmgr_send_pid_action(winfo->pid, PROCESS_ACTIVATE); + + if (winfo_deactive) + { + ELOGF("PROCESSMGR STATE", "PROCESS_DEACTIVATE. PID:%d", NULL, NULL, winfo_deactive->pid); + _e_processmgr_send_pid_action(winfo->pid, PROCESS_DEACTIVATE); + } + } + + return ECORE_CALLBACK_PASS_ON; +} + static void _pol_cb_hook_client_visibility(void *d EINA_UNUSED, E_Client *ec) { @@ -457,6 +521,7 @@ e_mod_processmgr_init(void) E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ICONIFY, _e_processmgr_cb_client_iconify, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_UNICONIFY, _e_processmgr_cb_client_uniconify, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_VISIBILITY_CHANGE, _e_processmgr_cb_client_visibility_change, NULL); + E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_FOCUS_IN, _e_processmgr_cb_client_focus_in, NULL); hook = e_client_hook_add(E_CLIENT_HOOK_EVAL_VISIBILITY, _pol_cb_hook_client_visibility, NULL); if (hook) hooks_ec = eina_list_append(hooks_ec, hook); diff --git a/src/e_mod_processmgr_shared_types.h b/src/e_mod_processmgr_shared_types.h index 2ee88c4..5ba9607 100644 --- a/src/e_mod_processmgr_shared_types.h +++ b/src/e_mod_processmgr_shared_types.h @@ -13,7 +13,9 @@ typedef enum _E_ProcessMgr_Action PROCESS_RESUME = 1, PROCESS_TERMINATE = 2, PROCESS_FOREGROUND = 3, - PROCESS_BACKGROUND = 4 + PROCESS_BACKGROUND = 4, + PROCESS_ACTIVATE = 5, + PROCESS_DEACTIVATE = 6, } E_ProcessMgr_Action; typedef enum _E_Process_State @@ -29,6 +31,7 @@ struct _E_ProcessMgr Eina_Hash *wins_hash; Eina_Inlist *pids_list; Eina_Inlist *wins_list; + E_Client *active_win; }; struct _E_ProcessInfo @@ -38,6 +41,7 @@ struct _E_ProcessInfo Eina_List *wins; E_Process_State state; Eina_Bool launch; + Eina_Bool activate; }; struct _E_WindowInfo