summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-12 19:08:44 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-17 09:12:22 +0100
commit27e5e8fa757a784d2de91a712b5ea64aa264c8b5 (patch)
treed56fa734e468f26c280fa313479eadebcd082c88 /src
parent5e0a602ee84957d0f39c3d9eadc1dceca1ed649c (diff)
elm_gengrid: improve genlist behaviour
the new behaviour is (as genlist in the previous commit): - focus the first item when down is pressed - focus the last item when up is pressed - do not go into the widget with tab or ctrl+tab and just return immidiantly fixes T6805 Reviewed-by: YeongJong Lee <yj34.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7454
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/elm_gengrid.c43
-rw-r--r--src/lib/elementary/elm_gengrid.eo1
2 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index ef3da833fb..ba710210b0 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -4260,6 +4260,49 @@ _elm_gengrid_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Gengrid_Data
4260 } 4260 }
4261} 4261}
4262 4262
4263static Efl_Ui_Focus_Object*
4264_select_candidate(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction direction)
4265{
4266 Elm_Object_Item *first = elm_gengrid_first_item_get(obj);
4267 Elm_Object_Item *last = elm_gengrid_last_item_get(obj);
4268
4269 switch(direction)
4270 {
4271 case EFL_UI_FOCUS_DIRECTION_DOWN:
4272 case EFL_UI_FOCUS_DIRECTION_RIGHT:
4273 elm_object_item_focus_set(first, EINA_TRUE);
4274 return obj;
4275 break;
4276 case EFL_UI_FOCUS_DIRECTION_UP:
4277 case EFL_UI_FOCUS_DIRECTION_LEFT:
4278 elm_object_item_focus_set(last, EINA_TRUE);
4279 return obj;
4280 break;
4281 case EFL_UI_FOCUS_DIRECTION_NEXT:
4282 case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
4283 //do not go further with logical movement
4284 return NULL;
4285 break;
4286 default:
4287 ERR("Uncaught focus direction");
4288 return NULL;
4289 break;
4290 }
4291}
4292
4293EOLIAN static Efl_Ui_Focus_Object*
4294_elm_gengrid_efl_ui_focus_manager_move(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction direction)
4295{
4296 if (efl_ui_focus_manager_focus_get(obj) == obj)
4297 {
4298 return _select_candidate(obj, pd, direction);
4299 }
4300 else
4301 {
4302 return efl_ui_focus_manager_move(efl_super(obj, MY_CLASS), direction);
4303 }
4304}
4305
4263EOLIAN static Efl_Ui_Focus_Object* 4306EOLIAN static Efl_Ui_Focus_Object*
4264_elm_gengrid_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Gengrid_Data *pd) 4307_elm_gengrid_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Gengrid_Data *pd)
4265{ 4308{
diff --git a/src/lib/elementary/elm_gengrid.eo b/src/lib/elementary/elm_gengrid.eo
index 55f7f5420c..55ded4174d 100644
--- a/src/lib/elementary/elm_gengrid.eo
+++ b/src/lib/elementary/elm_gengrid.eo
@@ -529,6 +529,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface_Scroll
529 Efl.Ui.Widget.focus_state_apply; 529 Efl.Ui.Widget.focus_state_apply;
530 Efl.Ui.Focus.Manager.setup_on_first_touch; 530 Efl.Ui.Focus.Manager.setup_on_first_touch;
531 Efl.Ui.Focus.Manager.manager_focus { get; } 531 Efl.Ui.Focus.Manager.manager_focus { get; }
532 Efl.Ui.Focus.Manager.move;
532 } 533 }
533 events { 534 events {
534 realized: Efl.Object; [[Called when gengrid realized]] 535 realized: Efl.Object; [[Called when gengrid realized]]