diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-07-15 21:00:56 +0200 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2019-07-17 10:17:44 -0700 |
commit | e76349cd41d92b5fcf189d21a79c8d40dfeb9604 (patch) | |
tree | 93638049015d493e257ec89b180d789c8b7665f7 | |
parent | f62d0dc36b6ba46d544aa9103036dfac60bd200c (diff) | |
download | efl-e76349cd41d92b5fcf189d21a79c8d40dfeb9604.tar.gz |
efl_ui_widget: performance optimize deletion
when a logic parent does not have any widgets left, the parent needs to
be reevaluated. However, this only has to happen when there is a change
in state (eg. from 0 -> N or from N -> 0). Every other call can be
safed. This commit introduces this checking, and safes up performance.
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9323
-rw-r--r-- | src/lib/elementary/efl_ui_widget.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 2ed0f9b379..a8d8987a6e 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -490,6 +490,10 @@ _logical_parent_eval(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd, Eina_Bool s { ELM_WIDGET_DATA_GET_OR_RETURN(pd->logical.parent, logical_wd, NULL); logical_wd->logical.child_count --; + if (logical_wd->logical.child_count == 0) + { + *state_change_to_parent = EINA_TRUE; + } } old = pd->logical.parent; efl_weak_unref(&pd->logical.parent); @@ -525,19 +529,23 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd) old_parent = _logical_parent_eval(obj, pd, should, &state_change_to_parent); - if (efl_isa(old_parent, EFL_UI_WIDGET_CLASS)) + if (state_change_to_parent) { - //emit signal and focus eval old and new - ELM_WIDGET_DATA_GET(old_parent, old_pd); - _full_eval(old_parent, old_pd); - } + if (efl_isa(old_parent, EFL_UI_WIDGET_CLASS)) + { + //emit signal and focus eval old and new + ELM_WIDGET_DATA_GET(old_parent, old_pd); + _full_eval(old_parent, old_pd); + } - if (state_change_to_parent && efl_isa(pd->logical.parent, EFL_UI_WIDGET_CLASS)) - { - ELM_WIDGET_DATA_GET(pd->logical.parent, new_pd); - _full_eval(pd->logical.parent, new_pd); + if (efl_isa(pd->logical.parent, EFL_UI_WIDGET_CLASS)) + { + ELM_WIDGET_DATA_GET(pd->logical.parent, new_pd); + _full_eval(pd->logical.parent, new_pd); + } } + _focus_manager_eval(obj, pd, want_full, should); old_registered_parent = pd->focus.parent; |