From 23e7155840003ca91f72a5e99073f35f2ca6b293 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Sat, 22 Apr 2017 10:41:07 +0200 Subject: [PATCH] efl_ui_focus_manager: change the new order that gets set Lets say there is a box with the following ordered children: |Button|Box|Button|Box|Button| the two boxes do not have any children at the time of the setup. The logic of the order_update will only order the children like that: |Button|Button|Button| Which is correct by that time, the two boxes dont have any children. Now the two boxes are also getting children, the order will not selfupdate or anything so the logical chain would be: |Button|Button|Button|Box|Box|. Which is wrong. To solve that the manager keeps the order that got set last, and reapplies the order again if something gets added to the parent where the order was set. This should fix strange next / prev operations in ephoto. --- src/lib/elementary/efl_ui_focus_manager.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_manager.c b/src/lib/elementary/efl_ui_focus_manager.c index fb431a7..8d8db1c 100644 --- a/src/lib/elementary/efl_ui_focus_manager.c +++ b/src/lib/elementary/efl_ui_focus_manager.c @@ -56,6 +56,7 @@ struct _Node{ struct _Tree_Node{ Node *parent; //the parent in the tree Eina_List *children; //this saves the original set of elements + Eina_List *safed_order; }tree; struct _Graph_Node { @@ -530,6 +531,15 @@ _efl_ui_focus_manager_register_logical(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, E node->type = NODE_TYPE_ONLY_LOGICAL; node->redirect_manager = redirect; + //set again + if (T(pnode).safed_order) + { + Eina_List *tmp; + + tmp = eina_list_clone(T(pnode).safed_order); + efl_ui_focus_manager_update_order(obj, parent, tmp); + } + return EINA_TRUE; } @@ -563,6 +573,15 @@ _efl_ui_focus_manager_register(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Fo //mark dirty dirty_add(obj, pd, node); + //set again + if (T(pnode).safed_order) + { + Eina_List *tmp; + + tmp = eina_list_clone(T(pnode).safed_order); + efl_ui_focus_manager_update_order(obj, parent, tmp); + } + return EINA_TRUE; } @@ -651,15 +670,20 @@ _efl_ui_focus_manager_update_order(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_U { Node *pnode; Efl_Ui_Focus_Object *o; - Eina_List *node_order = NULL, *not_ordered, *trash, *node_order_clean; + Eina_List *node_order = NULL, *not_ordered, *trash, *node_order_clean, *n; + + F_DBG("Manager_update_order on %p %p", obj, parent); pnode = node_get(obj, pd, parent); if (!pnode) return; + ELM_SAFE_FREE(T(pnode).safed_order, eina_list_free); + T(pnode).safed_order = order; + //get all nodes from the subset - EINA_LIST_FREE(order, o) + EINA_LIST_FOREACH(order, n, o) { Node *tmp; -- 2.7.4