bu5hm4n pushed a commit to branch master.

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

commit 452d1096276450c03bdc697f5cbd1a54f95610f6
Author: Marcel Hollerbach <[email protected]>
Date:   Sun Jun 25 17:50:35 2017 +0200

    elm_fileselector: correct the focus chain
---
 src/lib/elementary/elc_fileselector.c  | 61 ++++++++++++++++++++++++++++------
 src/lib/elementary/elm_fileselector.eo |  1 +
 2 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/src/lib/elementary/elc_fileselector.c 
b/src/lib/elementary/elc_fileselector.c
index ffdc8444d2..78e015277f 100644
--- a/src/lib/elementary/elc_fileselector.c
+++ b/src/lib/elementary/elc_fileselector.c
@@ -92,6 +92,30 @@ EFL_CALLBACKS_ARRAY_DEFINE(monitoring_callbacks,
                           { EFL_MODEL_EVENT_CHILD_ADDED, _resource_created },
                           { EFL_MODEL_EVENT_CHILD_REMOVED, _resource_deleted 
});
 
+
+static void
+_focus_chain_update(Eo *obj, Elm_Fileselector_Data *pd)
+{
+   Eina_List *tmp = NULL;
+
+#define A(p) tmp = eina_list_append(tmp, p);
+
+   A(pd->up_button)
+   A(pd->home_button)
+   A(pd->search_entry)
+   A(pd->files_view)
+   A(pd->path_entry)
+   A(pd->name_entry)
+   A(pd->filter_hoversel)
+   A(pd->ok_button)
+   A(pd->cancel_button)
+
+
+#undef A
+
+   efl_ui_focus_manager_update_order(efl_ui_focus_user_manager_get(obj), obj, 
tmp);
+}
+
 static void
 _model_free_eo_cb(void *data)
 {
@@ -1990,6 +2014,8 @@ _elm_fileselector_efl_canvas_group_group_add(Eo *obj, 
Elm_Fileselector_Data *pri
    elm_object_part_content_set(obj, "elm.swallow.files", priv->files_view);
 
    elm_obj_layout_sizing_eval(obj);
+
+   _focus_chain_update(obj, priv);
 }
 
 EOLIAN static void
@@ -2154,6 +2180,8 @@ 
_elm_fileselector_elm_interface_fileselector_is_save_set(Eo *obj, Elm_Fileselect
 
    if (is_save) elm_layout_signal_emit(obj, "elm,state,save,on", "elm");
    else elm_layout_signal_emit(obj, "elm,state,save,off", "elm");
+
+   _focus_chain_update(obj, sd);
 }
 
 EAPI Eina_Bool
@@ -2213,16 +2241,6 @@ _elm_fileselector_buttons_ok_cancel_set(Eo *obj, 
Elm_Fileselector_Data *sd, Eina
 
    if (visible)
      {
-        // cancel btn
-        bt = elm_button_add(obj);
-        efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
-        elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Cancel"));
-
-        efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _canc, obj);
-
-        sd->cancel_button = bt;
-        elm_object_part_content_set(obj, "elm.swallow.cancel", 
sd->cancel_button);
-
         // ok btn
         bt = elm_button_add(obj);
         efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
@@ -2232,12 +2250,24 @@ _elm_fileselector_buttons_ok_cancel_set(Eo *obj, 
Elm_Fileselector_Data *sd, Eina
 
         sd->ok_button = bt;
         elm_object_part_content_set(obj, "elm.swallow.ok", sd->ok_button);
+
+        // cancel btn
+        bt = elm_button_add(obj);
+        efl_ui_mirrored_automatic_set(bt, EINA_FALSE);
+        elm_object_domain_translatable_text_set(bt, PACKAGE, N_("Cancel"));
+
+        efl_event_callback_add(bt, EFL_UI_EVENT_CLICKED, _canc, obj);
+
+        sd->cancel_button = bt;
+        elm_object_part_content_set(obj, "elm.swallow.cancel", 
sd->cancel_button);
      }
    else
      {
         ELM_SAFE_FREE(sd->cancel_button, evas_object_del);
         ELM_SAFE_FREE(sd->ok_button, evas_object_del);
      }
+
+   _focus_chain_update(obj, sd);
 }
 
 EOLIAN static Eina_Bool
@@ -3089,6 +3119,17 @@ 
_elm_fileselector_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm
 }
 
 EOLIAN static Eina_Bool
+_elm_fileselector_elm_widget_focus_register(Eo *obj, Elm_Fileselector_Data 
*pd, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool 
full)
+{
+   Eina_Bool ret = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), 
manager, logical, full);
+
+   _focus_chain_update(obj, pd);
+
+   return ret;
+}
+
+
+EOLIAN static Eina_Bool
 _elm_fileselector_elm_widget_focus_direction(Eo *obj EINA_UNUSED, 
Elm_Fileselector_Data *sd, const Evas_Object *base, double degree, Evas_Object 
**direction, Elm_Object_Item **direction_item, double *weight)
 {
    Eina_List *items = NULL;
diff --git a/src/lib/elementary/elm_fileselector.eo 
b/src/lib/elementary/elm_fileselector.eo
index d9f1e82142..7817c4c4da 100644
--- a/src/lib/elementary/elm_fileselector.eo
+++ b/src/lib/elementary/elm_fileselector.eo
@@ -41,6 +41,7 @@ class Elm.Fileselector (Elm.Layout, 
Elm.Interface.Fileselector,
       Elm.Widget.widget_event;
       Elm.Widget.theme_apply;
       Elm.Widget.focus_next_manager_is;
+      Elm.Widget.focus_register;
       Elm.Interface.Fileselector.selected_models { get; }
       Elm.Interface.Fileselector.selected_model_get;
       Elm.Interface.Fileselector.selected_model_set;

-- 


Reply via email to