efl_ui_focus_manager: refactor _request_subchild_except

Summary:
this is more usefull with a focusable and not a node, since the node can
be already freed in some cases.

ref D11667

Reviewers: zmike

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11669
This commit is contained in:
Marcel Hollerbach 2020-04-14 11:29:05 -04:00 committed by Mike Blumenkrantz
parent 63e5216951
commit 728fd911ea
1 changed files with 4 additions and 4 deletions

View File

@ -776,10 +776,10 @@ _efl_ui_focus_manager_calc_update_children(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Man
} }
static inline Node* static inline Node*
_request_subchild_except(Node *n, Node *except) _request_subchild_except(Node *n, Eo *except)
{ {
n = _request_subchild(n); n = _request_subchild(n);
while (n == except) while (n && n->focusable == except)
{ {
n = _next(n); n = _next(n);
} }
@ -810,7 +810,7 @@ _efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_
{ {
n = eina_list_nth(pd->focus_stack, eina_list_count(pd->focus_stack) - 2); n = eina_list_nth(pd->focus_stack, eina_list_count(pd->focus_stack) - 2);
if (!n) if (!n)
n = _request_subchild_except(pd->root, node); n = _request_subchild_except(pd->root, node->focusable);
if (n) if (n)
efl_ui_focus_manager_focus_set(obj, n->focusable); efl_ui_focus_manager_focus_set(obj, n->focusable);
@ -1998,7 +1998,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_pop_history_stack(Eo *obj EINA_U
} }
else else
{ {
last = _request_subchild_except(pd->root, node_get(obj, pd, last_focusable)); last = _request_subchild_except(pd->root, last_focusable);
if (last) if (last)
efl_ui_focus_manager_focus_set(obj, last->focusable); efl_ui_focus_manager_focus_set(obj, last->focusable);
} }