e_policy: Remove the desk_client_add hook of policy when they called 30/299330/1
authorJunseok Kim <juns.kim@samsung.com>
Tue, 26 Sep 2023 04:10:39 +0000 (13:10 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 26 Sep 2023 06:27:11 +0000 (15:27 +0900)
There was a bug that the hook didn't removed if the ec didn't satisfy
the condition.
and the hook called repeatly when there're new client.
For prevent this bug, remove the hook when they called.

Change-Id: I709fe30b730f60cb5c91cd6dc341497cbed3a121

src/bin/e_policy.c

index 1a2b1af..de192de 100644 (file)
@@ -55,7 +55,6 @@ static Eina_Inlist *_e_policy_hooks[] =
 
 E_API int E_EVENT_POLICY_QUICKPANEL_VISIBLE_STATE_CHANGE = -1;
 
-static E_Policy_Client *_e_policy_client_add(E_Client *ec);
 static void        _e_policy_client_del(E_Policy_Client *pc);
 static Eina_Bool   _e_policy_client_normal_check(E_Client *ec);
 static Eina_Bool   _e_policy_client_maximize_policy_apply(E_Policy_Client *pc);
@@ -156,14 +155,14 @@ _e_policy_cb_hook_desk_client_add(void *d, E_Desk *desk)
    EINA_SAFETY_ON_NULL_RETURN(pc);
 
    ec = pc->ec;
-   EINA_SAFETY_ON_NULL_RETURN(ec);
+   EINA_SAFETY_ON_NULL_GOTO(ec, delete_hook);
 
-   if (!e_desk_has_ec(desk, ec)) return;
+   if (!e_desk_has_ec(desk, ec)) goto delete_hook;
 
-   if (e_object_is_del(E_OBJECT(ec))) return;
-   if (!_e_policy_client_normal_check(ec)) return;
-   if (ec->internal) return;
-   if (ec->new_client) return;
+   if (e_object_is_del(E_OBJECT(ec))) goto delete_hook;
+   if (!_e_policy_client_normal_check(ec)) goto delete_hook;
+   if (ec->internal) goto delete_hook;
+   if (ec->new_client) goto delete_hook;
 
    pd = eina_hash_find(hash_policy_desks, &desk);
    if (pd)
@@ -171,6 +170,7 @@ _e_policy_cb_hook_desk_client_add(void *d, E_Desk *desk)
    else
      _e_policy_client_maximize_policy_cancel(pc);
 
+delete_hook:
    // This function should be executed once when e_client adds on a desk.
    // Therefore, delete the desk_hooks.client_add.
    _e_policy_desk_client_add_hook_delete(pc);