davemds pushed a commit to branch elementary-1.10. http://git.enlightenment.org/core/elementary.git/commit/?id=4aefb91c58f3b4bf795f7b2814dd2f2eafa75305
commit 4aefb91c58f3b4bf795f7b2814dd2f2eafa75305 Author: davemds <[email protected]> Date: Sat Aug 9 15:47:59 2014 +0200 Gengrid: fix position calculation @fix To calc the position in a table you need to make the modulo of the col/row size, not the modulo on the x/y value This unbreak the elm_gengrid_item_pos_get() function that was reporting wrong values --- src/lib/elm_gengrid.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 87e5005..8af918c 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -123,8 +123,7 @@ _item_show_region(void *data) row = cvh / sd->item_height; if (row <= 0) row = 1; x = (it->position - 1) / row; - if (x == 0) y = it->position - 1; - else if (x > 0) y = (it->position - 1) % x; + y = (it->position - 1) % row; if (x >= 1) it_xpos = ((x - GG_IT(it)->prev_group) * sd->item_width) + (GG_IT(it)->prev_group * sd->group_item_width) @@ -139,10 +138,10 @@ _item_show_region(void *data) else if (sd->item_width > 0) { col = cvw / sd->item_width; + if (col <= 0) col = 1; y = (it->position - 1) / col; - if (y == 0) x = it->position - 1; - else if (y > 0) x = (it->position - 1) % y; + x = (it->position - 1) % col; it_xpos = x * sd->item_width + minx; if (y >= 1) it_ypos = ((y - GG_IT(it)->prev_group) * sd->item_height) --
