e_process: fix bug not changing action to no visible windows 60/278860/3 accepted/tizen/unified/20220728.131650 submit/tizen/20220727.055337
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 27 Jul 2022 00:27:30 +0000 (09:27 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 27 Jul 2022 04:57:03 +0000 (04:57 +0000)
There was a bug that the action of process was not changed to E_PROCESS_ACT_NO_VISIBLE_WINDOWS
when all windows of the process were hidden.
This resolve this problem.

Change-Id: I488ce2e5cf9b5fe3fe6c702dd2f490243559328f

src/bin/e_process.c

index e910570de7422046546d998aeda193f2e748d23f..e4d3d850db18f9bad89d413d7a640a1d63cc9546 100644 (file)
@@ -42,6 +42,7 @@ static int _e_process_hooks_walking = 0;
 
 static Eina_List *_e_process_ec_handlers = NULL;
 static Eina_List *_e_process_ec_hooks = NULL;
+static Eina_List *_e_process_comp_intercept_hooks = NULL;
 
 E_Process_Manager *_e_process_manager;
 
@@ -403,6 +404,39 @@ _e_process_cb_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
      }
 }
 
+static Eina_Bool
+_e_process_cb_intercept_hide(void *data EINA_UNUSED, E_Client *ec)
+{
+   E_Process *pinfo;
+   pid_t pid;
+   Eina_Bool visible;
+
+   pid = ec->netwm.pid;
+   pinfo = _e_process_find(_e_process_manager, pid);
+   if (!pinfo) goto intercept_hide_done;
+
+   if (ec->visibility.obscured != E_VISIBILITY_FULLY_OBSCURED)
+     goto intercept_hide_done;
+
+   if (pinfo->state == E_PROCESS_STATE_BACKGROUND)
+     goto intercept_hide_done;
+
+   if (_e_process_windows_visible_get(pid, &visible))
+     {
+        if (!visible)
+          {
+             if (!ec->visible)
+               {
+                  ELOGF("PROCESS", "Act no visible windows by hide callback. pid:%d", ec, pid);
+                  _e_process_windows_act_no_visible_update(pid);
+               }
+          }
+     }
+
+intercept_hide_done:
+   return EINA_TRUE;
+}
+
 static Eina_Bool
 _e_process_windows_visible_get(pid_t pid, Eina_Bool *visible)
 {
@@ -657,6 +691,11 @@ e_process_init(void)
    hook = e_client_hook_add(E_CLIENT_HOOK_DEL, _e_process_cb_hook_client_del, NULL);
    if (hook) _e_process_ec_hooks = eina_list_append(_e_process_ec_hooks, hook);
 
+   E_Comp_Object_Intercept_Hook *intercept_hook;
+   intercept_hook = e_comp_object_intercept_hook_add(E_COMP_OBJECT_INTERCEPT_HOOK_HIDE, _e_process_cb_intercept_hide, NULL);
+   if (intercept_hook)
+     _e_process_comp_intercept_hooks = eina_list_append(_e_process_comp_intercept_hooks, intercept_hook);
+
    _e_process_manager = e_pm;
 
    return EINA_TRUE;
@@ -669,6 +708,7 @@ e_process_shutdown(void)
 
    if (!_e_process_manager) return 0;
 
+   E_FREE_LIST(_e_process_comp_intercept_hooks, e_comp_object_intercept_hook_del);
    E_FREE_LIST(_e_process_ec_handlers, ecore_event_handler_del);
    EINA_LIST_FREE(_e_process_ec_hooks, hook)
       e_client_hook_del(hook);