From 455b878e70fe9c0a5a6a6529a07321c76257541e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 11 Oct 2012 12:27:13 +0000 Subject: [PATCH] some optimizations for e_box_item_at_xy_get SVN revision: 77864 --- src/bin/e_box.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/bin/e_box.c b/src/bin/e_box.c index c4a78d7ac..f533ddd8d 100644 --- a/src/bin/e_box.c +++ b/src/bin/e_box.c @@ -421,7 +421,32 @@ e_box_item_at_xy_get(Evas_Object *obj, Evas_Coord x, Evas_Coord y) if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR() NULL; sd = evas_object_smart_data_get(obj); if (!sd) return NULL; - EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi) + if (!E_INSIDE(x, y, sd->x, sd->y, sd->w, sd->h)) return NULL; + if (sd->horizontal) + { + if (x < sd->w / 2) + { + EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi) + { + if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj; + } + return NULL; + } + EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(sd->items), bi) + { + if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj; + } + return NULL; + } + if (y < sd->h / 2) + { + EINA_INLIST_FOREACH(EINA_INLIST_GET(sd->items), bi) + { + if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj; + } + return NULL; + } + EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(sd->items), bi) { if (E_INSIDE(x, y, bi->x, bi->y, bi->w, bi->h)) return bi->obj; }