forked from enlightenment/efl
genlist: Fix genlist index get bug
Because not all item block have "max_items_per_block" number of items in it's block. So the calculation is not correct when items are added & removed in each block. Anyhow, we need more efficient way for this API because genlist uses inlinst.
This commit is contained in:
parent
3695c3c0b3
commit
b79e3e4ffa
|
@ -7159,12 +7159,16 @@ elm_genlist_item_cursor_engine_only_get(const Elm_Object_Item *eo_it)
|
|||
EOLIAN static int
|
||||
_elm_genlist_item_index_get(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it)
|
||||
{
|
||||
int cnt = 0;
|
||||
Elm_Gen_Item *tmp;
|
||||
ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, -1);
|
||||
|
||||
if (it->item->block)
|
||||
return it->position + (it->item->block->position *
|
||||
GL_IT(it)->wsd->max_items_per_block);
|
||||
return -1;
|
||||
EINA_INLIST_FOREACH(GL_IT(it)->wsd->items, tmp)
|
||||
{
|
||||
if (tmp == it) break;
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
|
Loading…
Reference in New Issue