forked from enlightenment/efl
[access][layout] sort focus list based on geometry value
Conflicts: src/lib/elm_layout.c
This commit is contained in:
parent
b7cf4d8503
commit
7de1c8e8cf
|
@ -424,6 +424,39 @@ _elm_layout_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUS
|
|||
else
|
||||
*ret = EINA_FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
_access_focus_list_sort_cb(const void *data1, const void *data2)
|
||||
{
|
||||
Evas_Coord_Point p1, p2;
|
||||
Evas_Object *obj1, *obj2;
|
||||
|
||||
obj1 = ((Elm_Layout_Sub_Object_Data *)data1)->obj;
|
||||
obj2 = ((Elm_Layout_Sub_Object_Data *)data2)->obj;
|
||||
|
||||
evas_object_geometry_get(obj1, &p1.x, &p1.y, NULL, NULL);
|
||||
evas_object_geometry_get(obj2, &p2.x, &p2.y, NULL, NULL);
|
||||
|
||||
if (p1.y == p2.y)
|
||||
{
|
||||
return p1.x - p2.x;
|
||||
}
|
||||
|
||||
return p1.y - p2.y;
|
||||
}
|
||||
|
||||
static const Eina_List *
|
||||
_access_focus_list_sort(Eina_List *origin)
|
||||
{
|
||||
Eina_List *l, *temp = NULL;
|
||||
Elm_Layout_Sub_Object_Data *sub_d;
|
||||
|
||||
EINA_LIST_FOREACH(origin, l, sub_d)
|
||||
temp = eina_list_sorted_insert(temp, _access_focus_list_sort_cb, sub_d);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
/* WARNING: if you're making a widget *not* supposed to have focusable
|
||||
* child objects, but still inheriting from elm_layout, just set its
|
||||
* focus_next smart function back to NULL */
|
||||
|
@ -449,6 +482,9 @@ _elm_layout_smart_focus_next(Eo *obj, void *_pd, va_list *list)
|
|||
list_data_get = _elm_layout_list_data_get;
|
||||
|
||||
if (!items) return;
|
||||
|
||||
if (_elm_config->access_mode)
|
||||
items = _access_focus_list_sort((Eina_List *)items);
|
||||
}
|
||||
|
||||
int_ret = elm_widget_focus_list_next_get
|
||||
|
|
Loading…
Reference in New Issue