summaryrefslogtreecommitdiff
path: root/src/lib/elementary
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 /src/lib/elementary
parentbb38083287b963a63439f87a619ba514d89ded9c (diff)
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
Diffstat (limited to 'src/lib/elementary')
-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,
4361newblock: 4361newblock:
4362 if (it->item->rel) 4362 if (it->item->rel)
4363 { 4363 {
4364 // FIXME: Why is this case here??? This doesn't make sense at all!
4365 // There shouldn't be a goto in the first place!
4364 itb = calloc(1, sizeof(Item_Block)); 4366 itb = calloc(1, sizeof(Item_Block));
4365 if (!itb) return EINA_FALSE; 4367 if (!itb) return EINA_FALSE;
4366 itb->sd = sd; 4368 itb->sd = sd;
@@ -4536,6 +4538,12 @@ newblock:
4536 itbp->items = eina_list_append(itbp->items, it2); 4538 itbp->items = eina_list_append(itbp->items, it2);
4537 it2->item->block = itbp; 4539 it2->item->block = itbp;
4538 itbp->count++; 4540 itbp->count++;
4541 if (!it2->hide)
4542 {
4543 itb->vis_count--;
4544 itbp->num--;
4545 itbp->vis_count++;
4546 }
4539 4547
4540 if (it2->realized) itbp->realized = EINA_TRUE; 4548 if (it2->realized) itbp->realized = EINA_TRUE;
4541 } 4549 }
@@ -4563,6 +4571,13 @@ newblock:
4563 itbn->items = eina_list_prepend(itbn->items, it2); 4571 itbn->items = eina_list_prepend(itbn->items, it2);
4564 it2->item->block = itbn; 4572 it2->item->block = itbn;
4565 itbn->count++; 4573 itbn->count++;
4574 if (!it2->hide)
4575 {
4576 itb->h -= it->item->h;
4577 itb->vis_count--;
4578 itbn->h += it->item->h;
4579 itbn->vis_count++;
4580 }
4566 4581
4567 if (it2->realized) itbn->realized = EINA_TRUE; 4582 if (it2->realized) itbn->realized = EINA_TRUE;
4568 } 4583 }
@@ -4593,9 +4608,21 @@ newblock:
4593 itb2->items = eina_list_prepend(itb2->items, it2); 4608 itb2->items = eina_list_prepend(itb2->items, it2);
4594 it2->item->block = itb2; 4609 it2->item->block = itb2;
4595 itb2->count++; 4610 itb2->count++;
4611 if (!it2->hide)
4612 {
4613 itb->vis_count--;
4614 itb->h -= it2->item->h;
4615 itb2->vis_count++;
4616 itb2->h += it2->item->h;
4617 }
4596 4618
4597 if (it2->realized) itb2->realized = EINA_TRUE; 4619 if (it2->realized) itb2->realized = EINA_TRUE;
4598 } 4620 }
4621
4622 itb2->num = itb->num + itb->vis_count;
4623 itb2->x = itb->x;
4624 itb2->w = itb->w;
4625 itb2->y = itb->y + itb->h;
4599 } 4626 }
4600 } 4627 }
4601 4628