e_client: unify under pointer functions to e_client_under_position_get 26/321126/1
authorJunseok Kim <juns.kim@samsung.com>
Tue, 11 Mar 2025 05:29:34 +0000 (14:29 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 14 Mar 2025 07:29:03 +0000 (16:29 +0900)
Change-Id: I00a7e218ca572c6a0fc33b77ad82d61177866105

src/bin/core/e_client.c
src/bin/core/e_client_intern.h
src/bin/windowmgr/e_focus_policy_history.c

index 03aa606cf7ba698ab9706a5e4373ffde0d8acce0..c257fa7c98fc605ca6c60da389f959472fa89165 100644 (file)
@@ -1825,26 +1825,7 @@ _e_client_under_pointer_helper_ignore_client(E_Desk *desk, E_Client *ec)
 }
 
 static E_Client *
-_e_client_under_pointer_helper(E_Desk *desk, E_Client *exclude, int x, int y)
-{
-   E_Client *ec = NULL, *cec;
-
-   E_CLIENT_REVERSE_FOREACH(cec)
-     {
-        if (_e_client_under_pointer_helper_ignore_client(desk, cec)) continue;
-        if ((exclude) && (cec == exclude)) continue;
-        if (!E_INSIDE(x, y, cec->x, cec->y, cec->w, cec->h))
-          continue;
-        /* If the layer is higher, the position of the window is higher
-         * (always on top vs always below) */
-        if (!ec || (cec->layer > ec->layer))
-          ec = cec;
-     }
-   return ec;
-}
-
-static E_Client *
-_e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
+_e_client_under_pointer_input_helper(E_Desk *desk, int x, int y, E_Client *exclude_ec)
 {
    E_Client *ec = NULL, *cec;
 
@@ -1852,6 +1833,7 @@ _e_client_under_pointer_input_helper(E_Desk *desk, int x, int y)
      {
         Eina_Bool ignore_client = _e_client_under_pointer_helper_ignore_client(desk, cec);
         if (ignore_client) continue;
+        if ((exclude_ec) && (cec == exclude_ec)) continue;
 
         Eina_List *list = NULL;
         Eina_Rectangle *rect;
@@ -5101,55 +5083,22 @@ e_client_resize_limit(E_Client *ec, int *w, int *h)
 ////////////////////////////////////////////
 
 
-
-EINTERN E_Client *
-e_client_under_pointer_get(E_Desk *desk, E_Client *exclude)
-{
-   int x, y;
-
-   /* We need to ensure that we can get the comp window for the
-    * zone of either the given desk or the desk of the excluded
-    * window, so return if neither is given */
-   if (desk)
-     e_input_device_pointer_xy_get(NULL, &x, &y);
-   else if (exclude)
-     e_input_device_pointer_xy_get(NULL, &x, &y);
-   else
-     return NULL;
-
-   if (!desk)
-     {
-        desk = exclude->desk;
-        if (!desk)
-          {
-             if (exclude->zone)
-               desk = e_desk_current_get(exclude->zone);
-             else
-               desk = e_desk_current_get(e_zone_current_get());
-          }
-     }
-
-   return desk ? _e_client_under_pointer_helper(desk, exclude, x, y) : NULL;
-}
-
 E_API E_Client *e_client_under_position_get(E_Desk *desk, int x, int y, E_Client *exclude)
 {
    if (!desk) return NULL;
 
-   return _e_client_under_pointer_helper(desk, exclude, x, y);
+   return _e_client_under_pointer_input_helper(desk, x, y, exclude);
 }
 
 E_API E_Client *e_client_under_position_input_get(E_Desk *desk, int x, int y)
 {
    if (!desk) return NULL;
 
-   return _e_client_under_pointer_input_helper(desk, x, y);
+   return _e_client_under_pointer_input_helper(desk, x, y, NULL);
 }
 
 ////////////////////////////////////////////
 
-////////////////////////////////////////////
-
 E_API void
 e_client_redirected_set(E_Client *ec, Eina_Bool set)
 {
index 0ae42c95702b0d1ead695be18a55457ca30bb0e9..048fc3b4d5576b9f5ca1c280605ef013b4f3ff1c 100644 (file)
@@ -133,7 +133,6 @@ EINTERN void      e_client_signal_move_end(E_Client *ec, const char *sig EINA_UN
 EINTERN void      e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED);
 EINTERN void      e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED);
 
-EINTERN E_Client *e_client_under_pointer_get(E_Desk *desk, E_Client *exclude);
 EINTERN E_Client *e_client_transient_child_top_get(E_Client *ec, Eina_Bool consider_focus);
 EINTERN Eina_Bool e_client_mapped_get(E_Client *ec);
 EINTERN void      e_client_mapped_set(E_Client *ec, Eina_Bool set);
index cd2ab110d07f5fbdd09b1b09f57f120ba2023201..94f75cfd39f34b87a1c68119b4612ab201e0c982 100644 (file)
@@ -9,6 +9,7 @@
 #include "e_policy_zone_intern.h"
 #include "e_comp_canvas_intern.h"
 #include "e_policy_intern.h"
+#include "e_input_device_intern.h"
 
 typedef struct _E_Focus_Policy_History_Impl E_Focus_Policy_History;
 typedef struct _E_Focus_Policy_History_Client E_Focus_Policy_History_Client;
@@ -342,6 +343,7 @@ _focus_policy_history_focusable_get(E_Focus_Policy_History *history_policy, E_Cl
    E_Client *pec = NULL, *focusable_ec = NULL;
    E_Zone *zone;
    E_Desk *desk = NULL;
+   int x, y;
 
    if (stopping) return NULL;
 
@@ -357,7 +359,8 @@ _focus_policy_history_focusable_get(E_Focus_Policy_History *history_policy, E_Cl
    if (e_config->focus_policy == E_FOCUS_MOUSE)
      {
         // set mouse over focus
-        pec = e_client_under_pointer_get(desk, exclude_ec);
+        e_input_device_pointer_xy_get(NULL, &x, &y);
+        pec = e_client_under_position_get(desk, x, y, exclude_ec);
         if (pec)
           focusable_ec = pec;
         /* no autoraise/revert here because it's probably annoying */