summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-18 19:14:39 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-21 02:40:24 +0900
commit9c6edc463d944bcb600d81f6168f2e2f0068bb4b (patch)
treeed5039ade5bbaf975de2a74362b1119ae3419326
parent098797db358872a931764c31bada4de96be98d2f (diff)
list/genlist: Fixed Home and End key event handling routine.
Move selection when Home or End key is pressed. @fix This is a partial port from master.
-rw-r--r--src/lib/elm_genlist.c24
-rw-r--r--src/lib/elm_list.c22
2 files changed, 28 insertions, 18 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index f7414ac0a..94af9a0dd 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2552,21 +2552,25 @@ _elm_genlist_smart_event(Eo *obj, void *_pd, va_list *list)
2552 ((!strcmp(ev->key, "KP_Home")) && (!ev->string))) 2552 ((!strcmp(ev->key, "KP_Home")) && (!ev->string)))
2553 { 2553 {
2554 it = elm_genlist_first_item_get(obj); 2554 it = elm_genlist_first_item_get(obj);
2555 elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN); 2555 if (it)
2556 elm_genlist_item_selected_set(it, EINA_TRUE); 2556 {
2557 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 2557 elm_genlist_item_selected_set(it, EINA_TRUE);
2558 if (ret) *ret = EINA_TRUE; 2558 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2559 return; 2559 if (ret) *ret = EINA_TRUE;
2560 return;
2561 }
2560 } 2562 }
2561 else if ((!strcmp(ev->key, "End")) || 2563 else if ((!strcmp(ev->key, "End")) ||
2562 ((!strcmp(ev->key, "KP_End")) && (!ev->string))) 2564 ((!strcmp(ev->key, "KP_End")) && (!ev->string)))
2563 { 2565 {
2564 it = elm_genlist_last_item_get(obj); 2566 it = elm_genlist_last_item_get(obj);
2565 elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN); 2567 if (it)
2566 elm_genlist_item_selected_set(it, EINA_TRUE); 2568 {
2567 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 2569 elm_genlist_item_selected_set(it, EINA_TRUE);
2568 if (ret) *ret = EINA_TRUE; 2570 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2569 return; 2571 if (ret) *ret = EINA_TRUE;
2572 return;
2573 }
2570 } 2574 }
2571 else if ((!strcmp(ev->key, "Prior")) || 2575 else if ((!strcmp(ev->key, "Prior")) ||
2572 ((!strcmp(ev->key, "KP_Prior")) && (!ev->string))) 2576 ((!strcmp(ev->key, "KP_Prior")) && (!ev->string)))
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index c91497808..a6d6a6230 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -365,19 +365,25 @@ _elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
365 ((!strcmp(ev->key, "KP_Home")) && !ev->string)) 365 ((!strcmp(ev->key, "KP_Home")) && !ev->string))
366 { 366 {
367 it = eina_list_data_get(sd->items); 367 it = eina_list_data_get(sd->items);
368 elm_list_item_bring_in((Elm_Object_Item *)it); 368 if (it)
369 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 369 {
370 if (ret) *ret = EINA_TRUE; 370 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
371 return; 371 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
372 if (ret) *ret = EINA_TRUE;
373 return;
374 }
372 } 375 }
373 else if ((!strcmp(ev->key, "End")) || 376 else if ((!strcmp(ev->key, "End")) ||
374 ((!strcmp(ev->key, "KP_End")) && !ev->string)) 377 ((!strcmp(ev->key, "KP_End")) && !ev->string))
375 { 378 {
376 it = eina_list_data_get(eina_list_last(sd->items)); 379 it = eina_list_data_get(eina_list_last(sd->items));
377 elm_list_item_bring_in((Elm_Object_Item *)it); 380 if (it)
378 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 381 {
379 if (ret) *ret = EINA_TRUE; 382 elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
380 return; 383 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
384 if (ret) *ret = EINA_TRUE;
385 return;
386 }
381 } 387 }
382 else if ((!strcmp(ev->key, "Prior")) || 388 else if ((!strcmp(ev->key, "Prior")) ||
383 ((!strcmp(ev->key, "KP_Prior")) && !ev->string)) 389 ((!strcmp(ev->key, "KP_Prior")) && !ev->string))