elm_box/table: set the order directly when a container is registered
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>
Tue, 25 Apr 2017 15:04:50 +0000 (17:04 +0200)
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>
Tue, 25 Apr 2017 19:38:54 +0000 (21:38 +0200)
The following situation:
 - A Box in a naviframe, with n children.
 - All added children register to the focus graph with the box as parent,
   order gets set correctly.
 - Naviframe hides this item, so box property tree unfocusable gets set
   to true, it gets unregistered from the focus graph, even every single
   child gets unregistered.
 - The item gets shown - every child and the table are getting
   registered again.
 - Order is not set again, since the box does not get changed
 - Order of the children is mixed up.

This should fix this case since the order is flushed every time the box
gets registered.

src/lib/elementary/elm_box.c
src/lib/elementary/elm_box.eo
src/lib/elementary/elm_table.c
src/lib/elementary/elm_table.eo

index 580b707..f41815b 100644 (file)
@@ -715,5 +715,15 @@ _elm_box_class_constructor(Efl_Class *klass)
 {
    evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
 }
+EOLIAN Eina_Bool
+_elm_box_elm_widget_focus_register(Eo *obj, Elm_Box_Data *pd, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full)
+{
+   Eina_Bool result = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, full);
+
+   //later registering children are automatically set into the order of the internal table
+   _focus_order_flush(obj, pd);
+
+   return result;
+}
 
 #include "elm_box.eo.c"
index 61eda1b..da0d399 100644 (file)
@@ -295,6 +295,7 @@ class Elm.Box (Elm.Widget)
       Elm.Widget.focus_next;
       Elm.Widget.theme_apply;
       Elm.Widget.sub_object_del;
+      Elm.Widget.focus_register;
    }
    events {
       child,added; [[Called when child was added]]
index cd57be3..c4ddacd 100644 (file)
@@ -417,4 +417,16 @@ _elm_table_efl_canvas_group_group_calculate(Eo *obj, void *pd EINA_UNUSED)
    evas_object_smart_calculate(wd->resize_obj);
 }
 
+EOLIAN Eina_Bool
+_elm_table_elm_widget_focus_register(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full)
+{
+   Eina_Bool result = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, full);
+
+   //later registering children are automatically set into the order of the internal table
+   _focus_order_flush(obj);
+
+   return result;
+}
+
+
 #include "elm_table.eo.c"
index 92c8deb..fa3cd92 100644 (file)
@@ -129,5 +129,6 @@ class Elm.Table (Elm.Widget)
       Elm.Widget.focus_direction_manager_is;
       Elm.Widget.theme_apply;
       Elm.Widget.sub_object_del;
+      Elm.Widget.focus_register;
    }
 }