From b2996d8af1bfec1849b2d1d11d554f7ea0f32679 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Wed, 16 Feb 2022 14:02:07 +0900 Subject: [PATCH] e_zone: add new APIs for getting E_Zone - 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 | 36 ++++++++++++++++++++++++++++++++++++ src/bin/e_zone.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index 988c114..4ca4828 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -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) { diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h index 8987e23..d6d7343 100644 --- a/src/bin/e_zone.h +++ b/src/bin/e_zone.h @@ -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); -- 2.7.4