diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-11-21 20:57:32 +0100 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-11-26 11:37:04 +0100 |
commit | e661c4acc3805bc0d2b76b83352d43211e59498c (patch) | |
tree | d9242b5d02eefd18998bb49442a1e9feb2ee37c7 | |
parent | 976a33e36a6309133483d851495a5ed6d914628a (diff) | |
download | efl-e661c4acc3805bc0d2b76b83352d43211e59498c.tar.gz |
efl_ui_focus_manager_calc: reduce the amount of list operations
it appears that the calculation of the unordered elements can be done a
lot easier here, when checking in the initial for loop for the right
parent safes us two more list walk later on.
Additionally, if all elements in this chain have the right parent, and
the amount of elements is the same as the parent has, then this list can
be used as a full replacement.
Differential Revision: https://phab.enlightenment.org/D7330
-rw-r--r-- | src/lib/elementary/efl_ui_focus_manager_calc.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index 01cb8673cc..9dd444dde6 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -683,19 +683,21 @@ _efl_ui_focus_manager_calc_update_order(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data tmp = eina_hash_find(pd->node_hash, &o); if (!tmp) continue; + if (T(tmp).parent != pnode) continue; node_order = eina_list_append(node_order, tmp); } - - not_ordered = _set_a_without_b(T(pnode).children, node_order); - trash = _set_a_without_b(node_order, T(pnode).children); - node_order_clean = _set_a_without_b(node_order, trash); - - eina_list_free(node_order); - eina_list_free(trash); - - eina_list_free(T(pnode).children); - T(pnode).children = eina_list_merge(node_order_clean, not_ordered); + if (eina_list_count(node_order) == eina_list_count(T(pnode).children)) + { + eina_list_free(T(pnode).children); + T(pnode).children = node_order; + } + else + { + not_ordered = _set_a_without_b(T(pnode).children, node_order); + eina_list_free(T(pnode).children); + T(pnode).children = eina_list_merge(node_order, not_ordered); + } return; } |