e_focus_policy: use E_CLIENT_HOOK_MOVE 61/297561/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 17 Aug 2023 02:47:46 +0000 (11:47 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 21 Aug 2023 07:58:39 +0000 (16:58 +0900)
Use E_CLIENT_HOOK_MOVE instead of E_COMP_OBJECT_MOVE

Change-Id: Ib4b4da1f4db21b88f4392805e58d4437a084dd37

src/bin/e_comp_object.c
src/bin/e_focus_policy_history.c
src/bin/e_focus_policy_topmost.c

index a626882..7ea8b83 100644 (file)
@@ -226,7 +226,6 @@ static Eina_Inlist *_e_comp_object_hooks[] =
    [E_COMP_OBJECT_HOOK_RENDER_UPDATE_LOCK_SET] = NULL,
 //#ifdef REFACTOR_FOCUS_POLICY
    [E_COMP_OBJECT_HOOK_LOWER] = NULL,
-   [E_COMP_OBJECT_HOOK_MOVE] = NULL,
    [E_COMP_OBJECT_HOOK_SHOW] = NULL,
    [E_COMP_OBJECT_HOOK_HIDE] = NULL,
 //#endif
index 3680090..7ab9003 100644 (file)
@@ -571,6 +571,32 @@ _focus_policy_history_hook_cb_client_lower(void *data, E_Client *ec)
 }
 
 static void
+_focus_policy_history_hook_cb_client_move(void *data, E_Client *ec)
+{
+   E_Focus_Policy_History *history_policy;
+   E_Zone *zone;
+
+   history_policy = (E_Focus_Policy_History *)data;
+   if (!history_policy) return;
+
+   E_FOCUS_HISTORY_TRACE(history_policy, ec);
+
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
+
+   // no need to change the focused ec when ec is not focused.
+   if (!ec->focused) return;
+
+   // no need to change the focused ec when ec is in the area of a zone.
+   if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
+                    zone->x, zone->y, zone->w, zone->h))
+     {
+        // find the next focus and set it
+        _focus_policy_history_next_focus_set(history_policy, ec);
+     }
+}
+
+static void
 _focus_policy_history_hook_cb_client_focus_defer_set(void *data, E_Client *ec)
 {
    E_Focus_Policy_History *history_policy;
@@ -712,32 +738,6 @@ _focus_policy_hook_history_cb_comp_object_lower(void *data, E_Client *ec)
 }
 
 static Eina_Bool
-_focus_policy_history_hook_cb_comp_object_move(void *data, E_Client *ec)
-{
-   E_Focus_Policy_History *history_policy;
-   E_Zone *zone;
-
-   history_policy = (E_Focus_Policy_History *)data;
-   if (!history_policy) return EINA_TRUE;
-
-   // no need to change the focused ec when ec is not focused.
-   if (!ec->focused) return EINA_TRUE;
-
-   zone = e_comp_zone_find_by_ec(ec);
-   if (!zone) return EINA_TRUE;
-
-   // no need to change the focused ec when ec is in the area of a zone.
-   if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
-                    zone->x, zone->y, zone->w, zone->h))
-     return EINA_TRUE;
-
-   // find the next focus and set it
-   _focus_policy_history_next_focus_set(history_policy, ec);
-
-   return EINA_TRUE;
-}
-
-static Eina_Bool
 _focus_policy_history_hook_cb_comp_object_show(void *data, E_Client *ec)
 {
    E_Focus_Policy_History *history_policy;
@@ -1001,6 +1001,7 @@ e_focus_policy_iface_history_new(E_Zone* zone)
    E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_FOCUS_SET, _focus_policy_history_hook_cb_client_focus_set, history_policy);
    E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_FOCUS_UNSET, _focus_policy_history_hook_cb_client_focus_unset, history_policy);
    E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_LOWER, _focus_policy_history_hook_cb_client_lower, history_policy);
+   E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_MOVE, _focus_policy_history_hook_cb_client_move, history_policy);
    E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_FOCUS_DEFER_SET, _focus_policy_history_hook_cb_client_focus_defer_set, history_policy);
    E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_FOCUS_LATEST_SET, _focus_policy_history_hook_cb_client_focus_latest_set, history_policy);
    E_LIST_HOOK_APPEND(history_policy->ec_hooks, E_CLIENT_HOOK_ACTIVATE_DONE, _focus_policy_history_hook_cb_client_activate_done, history_policy);
@@ -1008,7 +1009,6 @@ e_focus_policy_iface_history_new(E_Zone* zone)
 
    // e_comp_object hooks
    E_COMP_COMP_HOOK_APPEND(history_policy->co_hooks, E_COMP_OBJECT_HOOK_LOWER, _focus_policy_hook_history_cb_comp_object_lower, history_policy);
-   E_COMP_COMP_HOOK_APPEND(history_policy->co_hooks, E_COMP_OBJECT_HOOK_MOVE,  _focus_policy_history_hook_cb_comp_object_move, history_policy);
    E_COMP_COMP_HOOK_APPEND(history_policy->co_hooks, E_COMP_OBJECT_HOOK_SHOW,  _focus_policy_history_hook_cb_comp_object_show, history_policy);
    E_COMP_COMP_HOOK_APPEND(history_policy->co_hooks, E_COMP_OBJECT_HOOK_HIDE,  _focus_policy_history_hook_cb_comp_object_hide, history_policy);
 
index 5e2d698..d42aa37 100644 (file)
@@ -12,7 +12,6 @@ struct _E_Focus_Policy_Topmost_Impl
    GMutex focused_ec_mutex;
 
    Eina_List *ec_hooks;
-   Eina_List *co_hooks;
    Eina_List *zone_hooks;
 };
 
@@ -315,42 +314,40 @@ _focus_policy_topmost_hook_cb_client_lower(void *data, E_Client *ec)
 }
 
 static void
-_focus_policy_topmost_hook_cb_client_eval_end(void *data, E_Client *ec)
+_focus_policy_topmost_hook_cb_client_move(void *data, E_Client *ec)
 {
    E_Focus_Policy_Topmost *topmost_policy;
+   E_Zone *zone;
 
    topmost_policy = (E_Focus_Policy_Topmost *)data;
    if (!topmost_policy) return;
 
-   if (e_object_is_del(E_OBJECT(ec))) return;
+   zone = e_comp_zone_find_by_ec(ec);
+   if (!zone) return;
 
-   ec->take_focus = ec->want_focus = 0;
+   // no need to change the focused ec when ec is not focused.
+   if (!ec->focused) return;
+
+   // no need to change the focused ec when ec is in the area of a zone.
+   if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
+                    zone->x, zone->y, zone->w, zone->h))
+     {
+        // find the next focus and set it
+        _focus_policy_topmost_next_focus_set(topmost_policy);
+     }
 }
 
-static Eina_Bool
-_focus_policy_topmost_hook_cb_comp_object_move(void *data, E_Client *ec)
+static void
+_focus_policy_topmost_hook_cb_client_eval_end(void *data, E_Client *ec)
 {
    E_Focus_Policy_Topmost *topmost_policy;
-   E_Zone *zone;
 
    topmost_policy = (E_Focus_Policy_Topmost *)data;
-   if (!topmost_policy) return EINA_TRUE;
-
-   // no need to change the focused ec when ec is not focused.
-   if (!ec->focused) return EINA_TRUE;
-
-   zone = e_comp_zone_find_by_ec(ec);
-   if (!zone) return EINA_TRUE;
-
-   // no need to change the focused ec when ec is in the area of a zone.
-   if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
-                    zone->x, zone->y, zone->w, zone->h))
-     return EINA_TRUE;
+   if (!topmost_policy) return;
 
-   // find the next focus and set it
-   _focus_policy_topmost_next_focus_set(topmost_policy);
+   if (e_object_is_del(E_OBJECT(ec))) return;
 
-   return EINA_TRUE;
+   ec->take_focus = ec->want_focus = 0;
 }
 
 static void
@@ -379,7 +376,6 @@ _focus_policy_topmost_del(E_Focus_Policy_Impl *impl)
    if (!topmost_policy) return;
 
    E_FREE_LIST(topmost_policy->zone_hooks, e_zone_hook_del);
-   E_FREE_LIST(topmost_policy->co_hooks, e_comp_object_hook_del);
    E_FREE_LIST(topmost_policy->ec_hooks, e_client_hook_del);
 
    g_mutex_clear(&topmost_policy->focused_ec_mutex);
@@ -465,11 +461,9 @@ e_focus_policy_iface_topmost_new(E_Zone* zone)
    E_LIST_HOOK_APPEND(topmost_policy->ec_hooks, E_CLIENT_HOOK_FOCUS_SET, _focus_policy_topmost_hook_cb_client_focus_set, topmost_policy);
    E_LIST_HOOK_APPEND(topmost_policy->ec_hooks, E_CLIENT_HOOK_FOCUS_UNSET, _focus_policy_topmost_hook_cb_client_focus_unset, topmost_policy);
    E_LIST_HOOK_APPEND(topmost_policy->ec_hooks, E_CLIENT_HOOK_LOWER, _focus_policy_topmost_hook_cb_client_lower, topmost_policy);
+   E_LIST_HOOK_APPEND(topmost_policy->ec_hooks, E_CLIENT_HOOK_MOVE, _focus_policy_topmost_hook_cb_client_move, topmost_policy);
    E_LIST_HOOK_APPEND(topmost_policy->ec_hooks, E_CLIENT_HOOK_EVAL_END, _focus_policy_topmost_hook_cb_client_eval_end, topmost_policy);
 
-   // e_comp_object hooks
-   E_COMP_COMP_HOOK_APPEND(topmost_policy->co_hooks, E_COMP_OBJECT_HOOK_MOVE,  _focus_policy_topmost_hook_cb_comp_object_move, topmost_policy);
-
    // e_zone hooks
    zone_hook = e_zone_hook_add(E_ZONE_HOOK_FOCUS_CLEAR, _focus_policy_topmost_hook_cb_zone_focus_clear, topmost_policy);
    if (zone_hook) topmost_policy->zone_hooks = eina_list_append(topmost_policy->zone_hooks, zone_hook);