From e22b7b94188072a2a98bec213ed5d51b438b37bd Mon Sep 17 00:00:00 2001 From: Yun ilkook Date: Fri, 14 Oct 2011 20:27:03 +0900 Subject: [PATCH] [*][Genlist] Fixed show hook event of smart scroller position received by entry was focused and smart pan resized Change-Id: Ib59add216f75e92541f14f6c4f0f8f469c65cacd --- src/lib/elm_genlist.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index a4312da..886548c 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -88,7 +88,9 @@ struct _Widget_Data Evas_Coord expand_item_gap; int move_effect_mode; Ecore_Job *changed_job; - Elm_Genlist_Item *rename_it; + Elm_Genlist_Item *focused_rename_it; + Evas_Coord current_scrl_x; + Evas_Coord current_scrl_y; }; struct _Item_Block @@ -654,13 +656,20 @@ _show_region_hook(void *data, { Widget_Data *wd = elm_widget_data_get(data); Evas_Coord x, y, w, h; + Evas_Coord px, py, pw, ph; + Evas_Coord new_x, new_y; if (!wd) return; elm_widget_show_region_get(obj, &x, &y, &w, &h); + evas_object_geometry_get(wd->pan_smart, &px, &py, &pw, &ph); + //x & y are screen coordinates, Add with pan coordinates - x += wd->pan_x; - y += wd->pan_y; - if(wd->rename_it) elm_genlist_item_bring_in(wd->rename_it); - else elm_smart_scroller_child_region_show(wd->scr, x, y, w, h); + new_x = wd->current_scrl_x + x - pw + w; + new_y = wd->current_scrl_y + y - ph + h; + + if (((new_y > 0) && wd->pan_changed && (y > ph)) || ((new_x > 0) && wd->pan_changed && (x > pw))) + elm_smart_scroller_child_pos_set(wd->scr, new_x, new_y); + else + elm_smart_scroller_child_pos_set(wd->scr, wd->current_scrl_x, wd->current_scrl_y); } static void @@ -1084,7 +1093,7 @@ _long_press(void *data) Eina_List *list, *l; it->long_timer = NULL; - if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->rename_it)) + if ((it->disabled) || (it->dragging) || (it->display_only) || (it->wd->focused_rename_it)) return ECORE_CALLBACK_CANCEL; it->wd->longpressed = EINA_TRUE; evas_object_smart_callback_call(it->base.widget, SIG_LONGPRESSED, it); @@ -1767,6 +1776,7 @@ _icon_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED { Elm_Genlist_Item *it = data; if (it) it->defer_unrealize = EINA_TRUE; + if (it->renamed && (it->wd->focused_rename_it != it)) it->wd->focused_rename_it = it; } static void @@ -1774,6 +1784,7 @@ _icon_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS { Elm_Genlist_Item *it = data; if (it) it->defer_unrealize = EINA_FALSE; + if (it->renamed && (it->wd->focused_rename_it == it)) it->wd->focused_rename_it = NULL; } static void @@ -3008,13 +3019,16 @@ _pan_calculate(Evas_Object *obj) Pan *sd = evas_object_smart_data_get(obj); Item_Block *itb; Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; + Evas_Coord scr_x, scr_y; int in = 0; Elm_Genlist_Item *git; Eina_List *l; if (!sd) return; evas_event_freeze(evas_object_evas_get(obj)); - + elm_smart_scroller_child_pos_get(sd->wd->scr, &scr_x, &scr_y); + sd->wd->current_scrl_x = scr_x; + sd->wd->current_scrl_y = scr_y; if (sd->wd->pan_changed) { _calc_job(sd->wd); @@ -5658,7 +5672,6 @@ elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed) { _item_unrealize(it, EINA_FALSE); it->renamed = EINA_TRUE; - it->wd->rename_it = it; it->nocache = EINA_TRUE; if (it->selected) _item_unselect(it); @@ -5671,7 +5684,6 @@ elm_genlist_item_rename_mode_set(Elm_Genlist_Item *it, Eina_Bool renamed) { it->renamed = EINA_FALSE; it->nocache = EINA_TRUE; - it->wd->rename_it = NULL; _item_cache_zero(it->wd); elm_genlist_item_update(it); } -- 2.7.4