bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=27e5e8fa757a784d2de91a712b5ea64aa264c8b5

commit 27e5e8fa757a784d2de91a712b5ea64aa264c8b5
Author: Marcel Hollerbach <[email protected]>
Date:   Wed Dec 12 19:08:44 2018 +0100

    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 <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D7454
---
 src/lib/elementary/elm_gengrid.c  | 43 +++++++++++++++++++++++++++++++++++++++
 src/lib/elementary/elm_gengrid.eo |  1 +
 2 files changed, 44 insertions(+)

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
       }
 }
 
+static Efl_Ui_Focus_Object*
+_select_candidate(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Direction 
direction)
+{
+   Elm_Object_Item *first = elm_gengrid_first_item_get(obj);
+   Elm_Object_Item *last = elm_gengrid_last_item_get(obj);
+
+   switch(direction)
+     {
+        case EFL_UI_FOCUS_DIRECTION_DOWN:
+        case EFL_UI_FOCUS_DIRECTION_RIGHT:
+          elm_object_item_focus_set(first, EINA_TRUE);
+          return obj;
+        break;
+        case EFL_UI_FOCUS_DIRECTION_UP:
+        case EFL_UI_FOCUS_DIRECTION_LEFT:
+          elm_object_item_focus_set(last, EINA_TRUE);
+          return obj;
+        break;
+        case EFL_UI_FOCUS_DIRECTION_NEXT:
+        case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
+          //do not go further with logical movement
+          return NULL;
+        break;
+        default:
+          ERR("Uncaught focus direction");
+          return NULL;
+        break;
+     }
+}
+
+EOLIAN static Efl_Ui_Focus_Object*
+_elm_gengrid_efl_ui_focus_manager_move(Eo *obj, Elm_Gengrid_Data *pd, 
Efl_Ui_Focus_Direction direction)
+{
+   if (efl_ui_focus_manager_focus_get(obj) == obj)
+     {
+        return _select_candidate(obj, pd, direction);
+     }
+   else
+     {
+        return efl_ui_focus_manager_move(efl_super(obj, MY_CLASS), direction);
+     }
+}
+
 EOLIAN static Efl_Ui_Focus_Object*
 _elm_gengrid_efl_ui_focus_manager_manager_focus_get(const Eo *obj, 
Elm_Gengrid_Data *pd)
 {
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
       Efl.Ui.Widget.focus_state_apply;
       Efl.Ui.Focus.Manager.setup_on_first_touch;
       Efl.Ui.Focus.Manager.manager_focus { get; }
+      Efl.Ui.Focus.Manager.move;
    }
    events {
       realized: Efl.Object; [[Called when gengrid realized]]

-- 


Reply via email to