forked from enlightenment/efl
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
This commit is contained in:
parent
d840a64550
commit
ef874d5b59
|
@ -60,6 +60,7 @@ struct _Node{
|
||||||
Node *parent; //the parent of the tree
|
Node *parent; //the parent of the tree
|
||||||
Eina_List *children; //this saves the original set of elements
|
Eina_List *children; //this saves the original set of elements
|
||||||
Eina_List *saved_order;
|
Eina_List *saved_order;
|
||||||
|
Eina_Bool clean_apply; //set if there was no new registration after a "update_order" call
|
||||||
}tree;
|
}tree;
|
||||||
|
|
||||||
struct _Graph_Node {
|
struct _Graph_Node {
|
||||||
|
@ -511,6 +512,7 @@ _register(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *chil
|
||||||
{
|
{
|
||||||
T(node).parent = parent;
|
T(node).parent = parent;
|
||||||
T(parent).children = eina_list_append(T(parent).children, node);
|
T(parent).children = eina_list_append(T(parent).children, node);
|
||||||
|
T(parent).clean_apply = EINA_FALSE;
|
||||||
}
|
}
|
||||||
node->type = NODE_TYPE_ONLY_LOGICAL;
|
node->type = NODE_TYPE_ONLY_LOGICAL;
|
||||||
node->redirect_manager = redirect;
|
node->redirect_manager = redirect;
|
||||||
|
@ -582,15 +584,6 @@ _efl_ui_focus_manager_calc_register(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd,
|
||||||
//mark dirty
|
//mark dirty
|
||||||
dirty_add(obj, pd, node);
|
dirty_add(obj, pd, node);
|
||||||
|
|
||||||
//set again
|
|
||||||
if (T(pnode).saved_order)
|
|
||||||
{
|
|
||||||
Eina_List *tmp;
|
|
||||||
|
|
||||||
tmp = eina_list_clone(T(pnode).saved_order);
|
|
||||||
efl_ui_focus_manager_calc_update_order(obj, parent, tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,6 +682,7 @@ _efl_ui_focus_manager_calc_update_order(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data
|
||||||
|
|
||||||
ELM_SAFE_FREE(T(pnode).saved_order, eina_list_free);
|
ELM_SAFE_FREE(T(pnode).saved_order, eina_list_free);
|
||||||
T(pnode).saved_order = order;
|
T(pnode).saved_order = order;
|
||||||
|
T(pnode).clean_apply = EINA_TRUE;
|
||||||
|
|
||||||
//get all nodes from the subset
|
//get all nodes from the subset
|
||||||
EINA_LIST_FOREACH(order, n, o)
|
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
|
||||||
eina_list_free(T(pnode).children);
|
eina_list_free(T(pnode).children);
|
||||||
T(pnode).children = eina_list_merge(node_order, not_ordered);
|
T(pnode).children = eina_list_merge(node_order, not_ordered);
|
||||||
}
|
}
|
||||||
|
T(pnode).clean_apply = EINA_TRUE;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1291,7 +1286,7 @@ _prev(Node *node)
|
||||||
|
|
||||||
|
|
||||||
static Node*
|
static Node*
|
||||||
_logical_movement(Efl_Ui_Focus_Manager_Calc_Data *pd EINA_UNUSED, Node *upper, Efl_Ui_Focus_Direction direction, Eina_Bool accept_logical)
|
_logical_movement(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd EINA_UNUSED, Node *upper, Efl_Ui_Focus_Direction direction, Eina_Bool accept_logical)
|
||||||
{
|
{
|
||||||
Node* (*deliver)(Node *n);
|
Node* (*deliver)(Node *n);
|
||||||
Node *result;
|
Node *result;
|
||||||
|
@ -1319,7 +1314,17 @@ _logical_movement(Efl_Ui_Focus_Manager_Calc_Data *pd EINA_UNUSED, Node *upper, E
|
||||||
stack = eina_list_append(stack, result);
|
stack = eina_list_append(stack, result);
|
||||||
|
|
||||||
if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
if (direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
||||||
efl_ui_focus_object_prepare_logical(result->focusable);
|
{
|
||||||
|
//set again
|
||||||
|
if (T(result).saved_order && !T(result).clean_apply)
|
||||||
|
{
|
||||||
|
Eina_List *tmp;
|
||||||
|
|
||||||
|
tmp = eina_list_clone(T(result).saved_order);
|
||||||
|
efl_ui_focus_manager_calc_update_order(obj, result->focusable, tmp);
|
||||||
|
}
|
||||||
|
efl_ui_focus_object_prepare_logical(result->focusable);
|
||||||
|
}
|
||||||
|
|
||||||
result = deliver(result);
|
result = deliver(result);
|
||||||
if (accept_logical)
|
if (accept_logical)
|
||||||
|
@ -1350,7 +1355,7 @@ _request_move(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Directio
|
||||||
|
|
||||||
if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS
|
if (direction == EFL_UI_FOCUS_DIRECTION_PREVIOUS
|
||||||
|| direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
|| direction == EFL_UI_FOCUS_DIRECTION_NEXT)
|
||||||
dir = _logical_movement(pd, upper, direction, accept_logical);
|
dir = _logical_movement(obj, pd, upper, direction, accept_logical);
|
||||||
else
|
else
|
||||||
dir = _coords_movement(obj, pd, upper, direction);
|
dir = _coords_movement(obj, pd, upper, direction);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ _efl_ui_focus_manager_root_focus_efl_ui_focus_manager_calc_register(Eo *obj, Efl
|
||||||
{
|
{
|
||||||
if (efl_ui_focus_manager_calc_register(efl_super(obj, MY_CLASS), child, parent, redirect))
|
if (efl_ui_focus_manager_calc_register(efl_super(obj, MY_CLASS), child, parent, redirect))
|
||||||
{
|
{
|
||||||
if (child != pd->rect)
|
if (child != pd->rect && pd->rect_registered)
|
||||||
_state_eval(obj, pd);
|
_state_eval(obj, pd);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -81,7 +81,7 @@ _efl_ui_focus_manager_root_focus_efl_ui_focus_manager_calc_register_logical(Eo *
|
||||||
{
|
{
|
||||||
if (efl_ui_focus_manager_calc_register_logical(efl_super(obj, MY_CLASS), child, parent, redirect))
|
if (efl_ui_focus_manager_calc_register_logical(efl_super(obj, MY_CLASS), child, parent, redirect))
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect && pd->rect_registered)
|
||||||
_state_eval(obj, pd);
|
_state_eval(obj, pd);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
Loading…
Reference in New Issue