summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehwan Kim <jae.hwan.kim@samsung.com>2015-08-12 11:09:14 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2015-08-28 17:39:52 +0530
commit1ad41b10dc77899c25f2c7d4b0164f338ea9a3d7 (patch)
tree86a7979b5aada8a18d457a76a9930b735fa0d31c
parent076885a247481d3e79bcfb9d1594ec16d65d8696 (diff)
gengird: change focus move mechanism in gengrid.
This commit is related to 4d553d2bcf2157053433994ca3facb56bd670da9. It doesn't work if item_select_on_focus_disable is 1. So _item_focus_down is changed like _item_single_select_down. @fix
-rw-r--r--src/lib/elm_gengrid.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 64ac25425..0d850d036 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -2094,32 +2094,40 @@ _item_focus_up(Elm_Gengrid_Data *sd)
2094static Eina_Bool 2094static Eina_Bool
2095_item_focus_down(Elm_Gengrid_Data *sd) 2095_item_focus_down(Elm_Gengrid_Data *sd)
2096{ 2096{
2097 unsigned int i; 2097 unsigned int i, idx;
2098 Elm_Gen_Item *next = NULL; 2098 Elm_Gen_Item *next = NULL;
2099 Elm_Object_Item *eo_tmp = NULL;
2099 2100
2100 if (!sd->focused_item) 2101 if (!sd->focused_item)
2101 { 2102 {
2102 next = ELM_GEN_ITEM_FROM_INLIST(sd->items); 2103 next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
2103 while ((next) && (next->generation < sd->generation)) 2104 while ((next) && (next->generation < sd->generation))
2104 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); 2105 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
2105
2106 elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE);
2107 return EINA_TRUE;
2108 } 2106 }
2109 else 2107 else
2110 { 2108 {
2111 Elm_Object_Item *eo_next = elm_gengrid_item_next_get(sd->focused_item);
2112 if (!eo_next) return EINA_FALSE;
2113 next = eo_data_scope_get(eo_next, ELM_GENGRID_ITEM_CLASS);
2114 if (eo_next == sd->focused_item) return EINA_FALSE;
2115 }
2116 2109
2117 for (i = 1; i < sd->nmax; i++) 2110 idx = elm_gengrid_item_index_get(sd->focused_item);
2118 { 2111
2119 Elm_Object_Item *eo_tmp = 2112 if (idx > sd->item_count -
2120 elm_gengrid_item_next_get(EO_OBJ(next)); 2113 ((sd->item_count % sd->nmax) == 0 ?
2121 if (!eo_tmp) return EINA_FALSE; 2114 sd->nmax : (sd->item_count % sd->nmax)))
2122 next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS); 2115 return EINA_FALSE;
2116 if (idx > sd->item_count - sd->nmax)
2117 {
2118 eo_tmp = elm_gengrid_last_item_get(sd->obj);
2119 next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS);
2120 }
2121 else
2122 {
2123 next = eo_data_scope_get(sd->focused_item, ELM_GENGRID_ITEM_CLASS);
2124 for (i = 0; i < sd->nmax; i++)
2125 {
2126 eo_tmp = elm_gengrid_item_next_get(EO_OBJ(next));
2127 if (!eo_tmp) return EINA_FALSE;
2128 next = eo_data_scope_get(eo_tmp, ELM_GENGRID_ITEM_CLASS);
2129 }
2130 }
2123 } 2131 }
2124 2132
2125 elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE); 2133 elm_object_item_focus_set(EO_OBJ(next), EINA_TRUE);