e_comp_wl: Add e_comp_wl_output_find_all() 58/284958/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 11 Aug 2022 05:21:19 +0000 (14:21 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 2 Dec 2022 00:22:49 +0000 (09:22 +0900)
The function returns an array containing all E_Comp_Wl_Output on which
given E_Client is placed.

It's been fine with e_comp_wl_output_find() so far, but if given
E_Client is the window placed on negative poisition, then
e_comp_wl_output_find() returns null unless there is a output that
has negative position which doesn't make sense.

Change-Id: I3ddb891803ff88ff0de48dbc58055ac190a2fa84

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index e5fb033..f945667 100644 (file)
@@ -5885,6 +5885,36 @@ e_comp_wl_output_find(E_Client *ec)
    return NULL;
 }
 
+EINTERN Eina_Array *
+e_comp_wl_output_find_all(E_Client *ec)
+{
+   E_Comp_Wl_Output *output;
+   Eina_Array *outputs;
+   Eina_List *l;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
+
+   outputs = eina_array_new(4);
+   if (!outputs)
+     return NULL;
+
+   EINA_LIST_FOREACH(e_comp_wl->outputs, l, output)
+     {
+        if (E_INTERSECTS(ec->x, ec->y, ec->w, ec->h,
+                         output->x, output->y, output->w, output->h))
+          {
+             eina_array_push(outputs, output);
+          }
+     }
+
+   if (eina_array_count(outputs) == 0)
+     {
+        eina_array_free(outputs);
+        return NULL;
+     }
+
+   return outputs;
+}
 
 // --------------------------------------------------------
 // tizen_move_resize
index 8471de5..3fda11c 100644 (file)
@@ -606,6 +606,7 @@ EINTERN void e_comp_wl_pos_convert_inverse(int width, int height, int transform,
 EINTERN void e_comp_wl_rect_convert(int width, int height, int transform, int scale, int sx, int sy, int sw, int sh, int *bx, int *by, int *bw, int *bh);
 EINTERN void e_comp_wl_rect_convert_inverse(int width, int height, int transform, int scale, int bx, int by, int bw, int bh, int *sx, int *sy, int *sw, int *sh);
 EINTERN E_Comp_Wl_Output* e_comp_wl_output_find(E_Client *ec);
+EINTERN Eina_Array *e_comp_wl_output_find_all(E_Client *ec);
 
 EINTERN void     e_comp_wl_feed_focus_in(E_Client *ec);