list/genlist: Fixed Home and End key event handling routine.

Move focus and selection when Home or End key is pressed.

@fix
This needs a partial backport to elementary-1.9
This commit is contained in:
Daniel Juyung Seo 2014-03-18 19:14:39 +09:00
parent 5b3908a454
commit 1c5f5ade61
2 changed files with 32 additions and 18 deletions

View File

@ -2700,21 +2700,27 @@ _elm_genlist_smart_event(Eo *obj, void *_pd, va_list *list)
((!strcmp(ev->key, "KP_Home")) && (!ev->string)))
{
it = elm_genlist_first_item_get(obj);
elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
elm_genlist_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
if (it)
{
elm_genlist_item_selected_set(it, EINA_TRUE);
elm_object_item_focus_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
}
}
else if ((!strcmp(ev->key, "End")) ||
((!strcmp(ev->key, "KP_End")) && (!ev->string)))
{
it = elm_genlist_last_item_get(obj);
elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
elm_genlist_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
if (it)
{
elm_genlist_item_selected_set(it, EINA_TRUE);
elm_object_item_focus_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
}
}
else if ((!strcmp(ev->key, "Prior")) ||
((!strcmp(ev->key, "KP_Prior")) && (!ev->string)))

View File

@ -436,19 +436,27 @@ _elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
((!strcmp(ev->key, "KP_Home")) && !ev->string))
{
it = eina_list_data_get(sd->items);
elm_list_item_bring_in((Elm_Object_Item *)it);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
if (it)
{
elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
}
}
else if ((!strcmp(ev->key, "End")) ||
((!strcmp(ev->key, "KP_End")) && !ev->string))
{
it = eina_list_data_get(eina_list_last(sd->items));
elm_list_item_bring_in((Elm_Object_Item *)it);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
if (it)
{
elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
if (ret) *ret = EINA_TRUE;
return;
}
}
else if ((!strcmp(ev->key, "Prior")) ||
((!strcmp(ev->key, "KP_Prior")) && !ev->string))