summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-08 14:54:48 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-17 09:12:22 +0100
commitef874d5b5940e9f16f783f4d54aec0da9655e976 (patch)
treef2ef1d105077fa1c6b4966f51b3c2249c6b1954d /src
parentd840a645506d6131331c7e5491dc696880d83a9a (diff)
efl_ui_focus_manager: performance optimize order setting
setting the order is a little bit expensive, this performance optimizes order setting in the focus manager. We don't need to set the order each time something is registered, it is enough to set it once we need the correct order. We don't need to evalulate the state in the Manager_Root_Focus if the rect is not registered. If its not, then another new element cannot cause the rect to be registered. Reviewed-by: YeongJong Lee <yj34.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7450
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c29
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_root_focus.c4
2 files changed, 19 insertions, 14 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index b5bf40bd02..b2b8356cf4 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -60,6 +60,7 @@ struct _Node{
60 Node *parent; //the parent of the tree 60 Node *parent; //the parent of the tree
61 Eina_List *children; //this saves the original set of elements 61 Eina_List *children; //this saves the original set of elements
62 Eina_List *saved_order; 62 Eina_List *saved_order;
63 Eina_Bool clean_apply; //set if there was no new registration after a "update_order" call
63 }tree; 64 }tree;
64 65
65 struct _Graph_Node { 66 struct _Graph_Node {
@@ -511,6 +512,7 @@ _register(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *chil
511 { 512 {
512 T(node).parent = parent; 513 T(node).parent = parent;
513 T(parent).children = eina_list_append(T(parent).children, node); 514 T(parent).children = eina_list_append(T(parent).children, node);
515 T(parent).clean_apply = EINA_FALSE;
514 } 516 }
515 node->type = NODE_TYPE_ONLY_LOGICAL; 517 node->type = NODE_TYPE_ONLY_LOGICAL;
516 node->redirect_manager = redirect; 518 node->redirect_manager = redirect;
@@ -582,15 +584,6 @@ _efl_ui_focus_manager_calc_register(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd,
582 //mark dirty 584 //mark dirty
583 dirty_add(obj, pd, node); 585 dirty_add(obj, pd, node);
584 586
585 //set again
586 if (T(pnode).saved_order)
587 {
588 Eina_List *tmp;
589
590 tmp = eina_list_clone(T(pnode).saved_order);
591 efl_ui_focus_manager_calc_update_order(obj, parent, tmp);
592 }
593
594 return EINA_TRUE; 587 return EINA_TRUE;
595} 588}
596 589
@@ -689,6 +682,7 @@ _efl_ui_focus_manager_calc_update_order(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data
689 682
690 ELM_SAFE_FREE(T(pnode).saved_order, eina_list_free); 683 ELM_SAFE_FREE(T(pnode).saved_order, eina_list_free);
691 T(pnode).saved_order = order; 684 T(pnode).saved_order = order;
685 T(pnode).clean_apply = EINA_TRUE;
692 686
693 //get all nodes from the subset 687 //get all nodes from the subset
694 EINA_LIST_FOREACH(order, n, o) 688 EINA_LIST_FOREACH(order, n, o)
@@ -713,6 +707,7 @@ _efl_ui_focus_manager_calc_update_order(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data
713 eina_list_free(T(pnode).children); 707 eina_list_free(T(pnode).children);
714 T(pnode).children = eina_list_merge(node_order, not_ordered); 708 T(pnode).children = eina_list_merge(node_order, not_ordered);
715 } 709 }
710 T(pnode).clean_apply = EINA_TRUE;
716 711
717 return; 712 return;
718} 713}
@@ -1291,7 +1286,7 @@ _prev(Node *node)
1291 1286
1292 1287
1293static Node* 1288static Node*
1294_logical_movement(Efl_Ui_Focus_Manager_Calc_Data *pd EINA_UNUSED, Node *upper, Efl_Ui_Focus_Direction direction, Eina_Bool accept_logical) 1289_logical_movement(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd EINA_UNUSED, Node *upper, Efl_Ui_Focus_Direction direction, Eina_Bool accept_logical)
1295{ 1290{
1296 Node* (*deliver)(Node *n); 1291 Node* (*deliver)(Node *n);
1297 Node *result; 1292 Node *result;
@@ -1319,7 +1314,17 @@ _logical_movement(Efl_Ui_Focus_Manager_Calc_Data *pd EINA_UNUSED, Node *upper, E
1319 stack = eina_list_append(stack, result); 1314 stack = eina_list_append(stack, result);
1320 1315
1321 if (direction == EFL_UI_FOCUS_DIRECTION_NEXT) 1316 if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
1322 efl_ui_focus_object_prepare_logical(result->focusable); 1317 {
1318 //set again
1319 if (T(result).saved_order && !T(result).clean_apply)
1320 {
1321 Eina_List *tmp;
1322
1323 tmp = eina_list_clone(T(result).saved_order);
1324 efl_ui_focus_manager_calc_update_order(obj, result->focusable, tmp);
1325 }
1326 efl_ui_focus_object_prepare_logical(result->focusable);
1327 }
1323 1328
1324 result = deliver(result); 1329 result = deliver(result);
1325 if (accept_logical) 1330 if (accept_logical)
@@ -1350,7 +1355,7 @@ _request_move(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Directio
1350 1355
1351 if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS 1356 if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS
1352 || direction == EFL_UI_FOCUS_DIRECTION_NEXT) 1357 || direction == EFL_UI_FOCUS_DIRECTION_NEXT)
1353 dir = _logical_movement(pd, upper, direction, accept_logical); 1358 dir = _logical_movement(obj, pd, upper, direction, accept_logical);
1354 else 1359 else
1355 dir = _coords_movement(obj, pd, upper, direction); 1360 dir = _coords_movement(obj, pd, upper, direction);
1356 1361
diff --git a/src/lib/elementary/efl_ui_focus_manager_root_focus.c b/src/lib/elementary/efl_ui_focus_manager_root_focus.c
index 4a2fd4ddba..f8a4c8653a 100644
--- a/src/lib/elementary/efl_ui_focus_manager_root_focus.c
+++ b/src/lib/elementary/efl_ui_focus_manager_root_focus.c
@@ -68,7 +68,7 @@ _efl_ui_focus_manager_root_focus_efl_ui_focus_manager_calc_register(Eo *obj, Efl
68{ 68{
69 if (efl_ui_focus_manager_calc_register(efl_super(obj, MY_CLASS), child, parent, redirect)) 69 if (efl_ui_focus_manager_calc_register(efl_super(obj, MY_CLASS), child, parent, redirect))
70 { 70 {
71 if (child != pd->rect) 71 if (child != pd->rect && pd->rect_registered)
72 _state_eval(obj, pd); 72 _state_eval(obj, pd);
73 73
74 return EINA_TRUE; 74 return EINA_TRUE;
@@ -81,7 +81,7 @@ _efl_ui_focus_manager_root_focus_efl_ui_focus_manager_calc_register_logical(Eo *
81{ 81{
82 if (efl_ui_focus_manager_calc_register_logical(efl_super(obj, MY_CLASS), child, parent, redirect)) 82 if (efl_ui_focus_manager_calc_register_logical(efl_super(obj, MY_CLASS), child, parent, redirect))
83 { 83 {
84 if (redirect) 84 if (redirect && pd->rect_registered)
85 _state_eval(obj, pd); 85 _state_eval(obj, pd);
86 86
87 return EINA_TRUE; 87 return EINA_TRUE;