also fix selected item scrolling when item prepended to the genlist is offscreen
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 30 May 2012 10:44:59 +0000 (10:44 +0000)
committerTae-Hwan Kim <the81.kim@samsung.com>
Thu, 12 Jul 2012 07:06:20 +0000 (16:06 +0900)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@71554 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

Conflicts:

src/lib/elm_genlist.c

Change-Id: I3424236e265ead16fce0adf60a2eb1b6f4f59791

src/lib/elm_genlist.c

index 81f1bea..ea96887 100644 (file)
@@ -4500,10 +4500,23 @@ _item_process_post(Widget_Data *wd, Elm_Gen_Item *it, Eina_Bool qadd)
    if (wd->selected && it->item->before)
      {
         int y, h;
-        it = wd->selected->data;
+        Elm_Gen_Item *it2;
+        it2 = wd->selected->data;
         elm_smart_scroller_child_pos_get(wd->scr, NULL, &y);
         evas_object_geometry_get(wd->pan_smart, NULL, NULL, NULL, &h);
-        elm_smart_scroller_child_region_show(wd->scr, it->x + it->item->block->x, y + it->item->h, it->item->block->w, h);
+        if ((it->y + it->item->block->y > y + h) || (it->y + it->item->block->y + it->item->h < y))
+          /* offscreen, just update */
+          elm_smart_scroller_child_region_show(wd->scr,
+                                               it2->x + it2->item->block->x,
+                                               y,
+                                               it2->item->block->w,
+                                               h);
+        else
+          elm_smart_scroller_child_region_show(wd->scr,
+                                               it->x + it->item->block->x,
+                                               y + it->item->h,
+                                               it->item->block->w,
+                                               h);
      }
 }