bu5hm4n pushed a commit to branch master.

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

commit f09dd5e3df812ae98846b9f42b090cdcafd7a644
Author: Marcel Hollerbach <[email protected]>
Date:   Tue Dec 20 17:24:09 2016 +0100

    efl_ui_focus_manager: allow settings of subsets
    
    those subsets will just be prepended.
---
 src/lib/elementary/efl_ui_focus_manager.c  | 37 ++++++++++++++++++++++++++----
 src/lib/elementary/efl_ui_focus_manager.eo |  1 +
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/lib/elementary/efl_ui_focus_manager.c 
b/src/lib/elementary/efl_ui_focus_manager.c
index 0412363..87afd28 100644
--- a/src/lib/elementary/efl_ui_focus_manager.c
+++ b/src/lib/elementary/efl_ui_focus_manager.c
@@ -613,6 +613,22 @@ _efl_ui_focus_manager_update_parent(Eo *obj EINA_UNUSED, 
Efl_Ui_Focus_Manager_Da
    return EINA_TRUE;
 }
 
+static Eina_List*
+_set_a_without_b(Eina_List *a, Eina_List *b)
+{
+   Eina_List *a_out = NULL, *node;
+   void *data;
+
+   a_out = eina_list_clone(a);
+
+   EINA_LIST_FOREACH(b, node, data)
+     {
+        a_out = eina_list_remove(a_out, data);
+     }
+
+   return a_out;
+}
+
 static Eina_Bool
 _equal_set(Eina_List *none_nodes, Eina_List *nodes)
 {
@@ -631,7 +647,7 @@ _equal_set(Eina_List *none_nodes, Eina_List *nodes)
 }
 
 EOLIAN static Eina_Bool
-_efl_ui_focus_manager_update_children(Eo *obj EINA_UNUSED, 
Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *parent, Eina_List *order)
+_efl_ui_focus_manager_update_children(Eo *obj EINA_UNUSED, 
Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus_Object *parent, Eina_List *order, 
Eina_Bool subset)
 {
    Node *pnode;
 
@@ -640,13 +656,24 @@ _efl_ui_focus_manager_update_children(Eo *obj 
EINA_UNUSED, Efl_Ui_Focus_Manager_
    if (!pnode)
      return EINA_FALSE;
 
-   if (!_equal_set(order, T(pnode).children))
+   if (!subset)
      {
-        ERR("Set of children is not equal");
-        return EINA_FALSE;
+        if (!_equal_set(order, T(pnode).children))
+          {
+             ERR("Set of children is not equal");
+             return EINA_FALSE;
+          }
+        T(pnode).children = order;
      }
+   else
+     {
+        Eina_List *not_ordered;
+
+        not_ordered = _set_a_without_b(T(pnode).children, order);
 
-   T(pnode).children = order;
+        eina_list_free(T(pnode).children);
+        T(pnode).children = eina_list_merge(order, not_ordered);
+     }
 
    return EINA_TRUE;
 }
diff --git a/src/lib/elementary/efl_ui_focus_manager.eo 
b/src/lib/elementary/efl_ui_focus_manager.eo
index fa8b4ed..9f85659 100644
--- a/src/lib/elementary/efl_ui_focus_manager.eo
+++ b/src/lib/elementary/efl_ui_focus_manager.eo
@@ -96,6 +96,7 @@ class Efl.Ui.Focus.Manager (Efl.Object) {
             params {
                 parent : Efl.Ui.Focus.Object @nonull; [[the parent to update]]
                 children : list<Efl.Ui.Focus.Object>; [[the list with the new 
order]]
+                subset : bool; [[$false to make sure childrenlist is the same 
size as the real logical children, $true to just add this order to the 
beginning of the children]]
             }
             return : bool;
         }

-- 


Reply via email to