diff options
author | Marcel Hollerbach <marcel-hollerbach@t-online.de> | 2016-12-20 17:24:09 +0100 |
---|---|---|
committer | Marcel Hollerbach <marcel-hollerbach@t-online.de> | 2017-04-19 13:31:59 +0200 |
commit | 68c2989bdc8ab7f9f387054019a3e49bd3364a79 (patch) | |
tree | 2effb079d13d62e82f363e62699e2c007e054b2a | |
parent | 762a7836c730a103daecfcb364222f46a16df291 (diff) | |
download | efl-68c2989bdc8ab7f9f387054019a3e49bd3364a79.tar.gz |
efl_ui_focus_manager: allow settings of subsets
those subsets will just be prepended.
-rw-r--r-- | src/lib/elementary/efl_ui_focus_manager.c | 37 | ||||
-rw-r--r-- | 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 04123638b5..87afd28d07 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 fa8b4ed65b..9f8565954d 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; } |