bu5hm4n pushed a commit to branch master.

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

commit e779492a1c029203d703ad31d4d647a45a5034dc
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Wed Dec 12 12:49:19 2018 +0100

    elm_genlist: behaviour fixes for genlist
    
    This implements the behaviour in case no item is yet focused, but the
    genlist is focused.
    
    ref T6805
    
    Reviewed-by: YeongJong Lee <yj34....@samsung.com>
    Differential Revision: https://phab.enlightenment.org/D7452
---
 src/lib/elementary/elm_genlist.c  | 43 +++++++++++++++++++++++++++++++++++++++
 src/lib/elementary/elm_genlist.eo |  1 +
 2 files changed, 44 insertions(+)

diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 728d33376b..0ad79d137a 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -3455,6 +3455,49 @@ 
_elm_genlist_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Genlist_D
    return focused_obj;
 }
 
+static Efl_Ui_Focus_Object*
+_select_candidate(Eo *obj, Elm_Genlist_Data *pd, Efl_Ui_Focus_Direction 
direction)
+{
+   Elm_Object_Item *first = elm_genlist_first_item_get(obj);
+   Elm_Object_Item *last = elm_genlist_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_genlist_efl_ui_focus_manager_move(Eo *obj, Elm_Genlist_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 Eina_Bool
 _elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
 {
diff --git a/src/lib/elementary/elm_genlist.eo 
b/src/lib/elementary/elm_genlist.eo
index 1d7e562616..9747b4765f 100644
--- a/src/lib/elementary/elm_genlist.eo
+++ b/src/lib/elementary/elm_genlist.eo
@@ -556,6 +556,7 @@ class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, 
Efl.Ui.Clickable,
       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 {
       item,focused: Efl.Object; [[Called when genlist item got focus]]

-- 


Reply via email to