summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-02-24 15:16:45 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-02-27 16:26:32 +0900
commit380759a89e88f3f3cc0d4038f3dc5bd5c623160f (patch)
tree65865d71a3286a3ea8793e35d5ad3608bd5210e7
parentbb38083287b963a63439f87a619ba514d89ded9c (diff)
downloadefl-380759a89e88f3f3cc0d4038f3dc5bd5c623160f.tar.gz
genlist: Fix rare jump in prepend insert
If an item is selected, and another item is insert before the selected item, then we try to lock the genlist view (pan) around the selected item (if it's visible). Unfortunately, every 16 inserts cause a jump by one line in the scroller. That's because the scroll math assumes the block position is known, but since it's a new block it wasn't known. This patch fixes this issue by precalculating the block position. Test scenario: elementary_test -to "Genlist Tree, Insert Relative" Select an item, clikck 50 times on "+ before". The view should not jump. This does not fix fileselector's craziness. @fix
-rw-r--r--src/lib/elementary/elm_genlist.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 7a49e47a6c..44252bac64 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -4361,6 +4361,8 @@ _item_block_add(Elm_Genlist_Data *sd,
newblock:
if (it->item->rel)
{
+ // FIXME: Why is this case here??? This doesn't make sense at all!
+ // There shouldn't be a goto in the first place!
itb = calloc(1, sizeof(Item_Block));
if (!itb) return EINA_FALSE;
itb->sd = sd;
@@ -4536,6 +4538,12 @@ newblock:
itbp->items = eina_list_append(itbp->items, it2);
it2->item->block = itbp;
itbp->count++;
+ if (!it2->hide)
+ {
+ itb->vis_count--;
+ itbp->num--;
+ itbp->vis_count++;
+ }
if (it2->realized) itbp->realized = EINA_TRUE;
}
@@ -4563,6 +4571,13 @@ newblock:
itbn->items = eina_list_prepend(itbn->items, it2);
it2->item->block = itbn;
itbn->count++;
+ if (!it2->hide)
+ {
+ itb->h -= it->item->h;
+ itb->vis_count--;
+ itbn->h += it->item->h;
+ itbn->vis_count++;
+ }
if (it2->realized) itbn->realized = EINA_TRUE;
}
@@ -4593,9 +4608,21 @@ newblock:
itb2->items = eina_list_prepend(itb2->items, it2);
it2->item->block = itb2;
itb2->count++;
+ if (!it2->hide)
+ {
+ itb->vis_count--;
+ itb->h -= it2->item->h;
+ itb2->vis_count++;
+ itb2->h += it2->item->h;
+ }
if (it2->realized) itb2->realized = EINA_TRUE;
}
+
+ itb2->num = itb->num + itb->vis_count;
+ itb2->x = itb->x;
+ itb2->w = itb->w;
+ itb2->y = itb->y + itb->h;
}
}