efl_ui_focus_manager: a logical item should never get focus.
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>
Thu, 17 Nov 2016 13:55:43 +0000 (14:55 +0100)
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>
Thu, 20 Apr 2017 12:38:57 +0000 (14:38 +0200)
src/lib/elementary/efl_ui_focus_manager.c
src/lib/elementary/efl_ui_focus_manager.eo
src/tests/elementary/elm_test_focus.c

index f32e5ac..2a04d61 100644 (file)
@@ -931,10 +931,20 @@ _prev(Node *node)
 static Node*
 _logical_movement(Efl_Ui_Focus_Manager_Data *pd EINA_UNUSED, Node *upper, Efl_Ui_Focus_Direction direction)
 {
+   Node* (*deliver)(Node *n);
+   Node *result;
    if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
-     return _next(upper);
+     deliver = _next;
    else
-     return _prev(upper);
+     deliver = _prev;
+
+   //search as long as we have a none logical parent
+   result = upper;
+   do {
+     result = deliver(result);
+   } while(result && result->type == NODE_TYPE_ONLY_LOGICAL);
+
+   return result;
 }
 
 EOLIAN static Efl_Ui_Focus_Object*
index 9cf8a36..6fb68d0 100644 (file)
@@ -59,7 +59,7 @@ class Efl.Ui.Focus.Manager (Efl.Object) {
         register_logical {
             [[Register a new item just for the logical parent.
 
-              This item can just be used as a parent for a child. It cannot be reached via coordinate wise movements.
+              The item can never get focus, it just help to build a tree out of the items who are getting focus.
             ]]
             params {
                 child : Efl.Ui.Focus.Object @nonull;
index 044d391..cf14dc3 100644 (file)
@@ -197,7 +197,7 @@ START_TEST(logical_chain)
    //register everything
    efl_ui_focus_manager_register(m, child1, root, NULL);
    efl_ui_focus_manager_register(m, child2, root, NULL);
-   efl_ui_focus_manager_register(m, child3, root, NULL);
+   efl_ui_focus_manager_register_logical(m, child3, root);
    efl_ui_focus_manager_register(m, subchild11, child1, NULL);
    efl_ui_focus_manager_register(m, subchild12, child1, NULL);
    efl_ui_focus_manager_register(m, subchild13, child1, NULL);
@@ -207,7 +207,7 @@ START_TEST(logical_chain)
 
    Efl_Object *logical_chain[] = {
     child1, subchild11, subchild12, subchild13,
-    child2, child3, subchild21, subchild22, subchild23, root, NULL
+    child2, subchild21, subchild22, subchild23, root, NULL
    };
    for (i = 0; logical_chain[i]; ++i)
      {