Elm_Gen_Item *tmp = eina_list_data_get(itb->items);
while(tmp && tmp->item->block == itb)
{
- if ((_item_focusable_search(&tmp, 1)) && (tmp->realized))
+ if (tmp->realized)
{
+ Evas_Object *old = tmp;
Evas_Coord x, y, w, h, sx, sy, sw, sh;
evas_object_geometry_get(VIEW(tmp), &x, &y, &w, &h);
evas_object_geometry_get(obj, &sx, &sy, &sw, &sh);
- /* Item is included viewport */
- if (ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h))
+ /* Item is included viewport and focusable */
+ if ((ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h)) &&
+ (_item_focusable_search(&tmp, 1)))
{
- elm_object_item_focus_set(EO_OBJ(tmp), EINA_TRUE);
- goto success;
+ Eina_Bool include = EINA_TRUE;
+ if (old != tmp && tmp->realized)
+ {
+ evas_object_geometry_get(VIEW(tmp), &x, &y, &w, &h);
+ evas_object_geometry_get(obj, &sx, &sy, &sw, &sh);
+ include = ELM_RECTS_INCLUDE(sx, sy, sw, sh, x, y, w, h);
+ }
+ else if (!tmp->realized) include = EINA_FALSE;
+
+ if (include)
+ {
+ elm_object_item_focus_set(EO_OBJ(tmp), EINA_TRUE);
+ goto success;
+ }
}
}