e_zone: add new APIs for getting E_Zone 50/271350/2
authorDoyoun Kang <doyoun.kang@samsung.com>
Wed, 16 Feb 2022 05:02:07 +0000 (14:02 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Fri, 18 Feb 2022 07:02:41 +0000 (07:02 +0000)
- E_Zone *e_zone_get_by_id(int id);
- E_Zone *e_zone_get_by_position(int x, int y);

Change-Id: I8f814a3a374dbe457dd9e9048954f4daa6497b77

src/bin/e_zone.c
src/bin/e_zone.h

index 988c114..4ca4828 100644 (file)
@@ -458,6 +458,42 @@ e_zone_current_get(void)
    return eina_list_data_get(e_comp->zones);
 }
 
+EINTERN E_Zone *
+e_zone_get_by_id(int id)
+{
+   Eina_List *l = NULL;
+   E_Zone *zone;
+
+   EINA_LIST_FOREACH(e_comp->zones, l, zone)
+     {
+        if (zone->id == id)
+          {
+             return zone;
+          }
+     }
+
+   ELOGF("E_ZONE", "No zone id:%d", NULL, id);
+   return NULL;
+}
+
+EINTERN E_Zone *
+e_zone_get_by_position(int x, int y)
+{
+   Eina_List *l = NULL;
+   E_Zone *zone;
+
+   EINA_LIST_FOREACH(e_comp->zones, l, zone)
+     {
+        if (E_INSIDE(x, y, zone->x, zone->y, zone->w, zone->h))
+          {
+             return zone;
+          }
+     }
+
+   ELOGF("E_ZONE", "No zone under position(%d,%d)", NULL, x, y);
+   return NULL;
+}
+
 E_API void
 e_zone_bg_reconfigure(E_Zone *zone)
 {
index 8987e23..d6d7343 100644 (file)
@@ -210,6 +210,8 @@ E_API void      e_zone_move(E_Zone *zone, int x, int y);
 E_API void      e_zone_resize(E_Zone *zone, int w, int h);
 E_API Eina_Bool  e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h);
 E_API E_Zone   *e_zone_current_get(void);
+EINTERN E_Zone *e_zone_get_by_id(int id);
+EINTERN E_Zone *e_zone_get_by_position(int x, int y);
 E_API void      e_zone_bg_reconfigure(E_Zone *zone);
 E_API void      e_zone_flip_coords_handle(E_Zone *zone, int x, int y);
 E_API void      e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count);