efl_ui_focus_manager: refactor _request_subchild_except
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Tue, 14 Apr 2020 15:29:05 +0000 (11:29 -0400)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 15 Apr 2020 22:54:45 +0000 (07:54 +0900)
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

src/lib/elementary/efl_ui_focus_manager_calc.c

index 75bac16..43761d4 100644 (file)
@@ -781,10 +781,10 @@ _efl_ui_focus_manager_calc_update_children(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Man
 }
 
 static inline Node*
-_request_subchild_except(Node *n, Node *except)
+_request_subchild_except(Node *n, Eo *except)
 {
    n = _request_subchild(n);
-   while (n == except)
+   while (n && n->focusable == except)
      {
         n = _next(n);
      }
@@ -815,7 +815,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);
                   if (!n)
-                    n = _request_subchild_except(pd->root, node);
+                    n = _request_subchild_except(pd->root, node->focusable);
 
                   if (n)
                     efl_ui_focus_manager_focus_set(obj, n->focusable);
@@ -2003,7 +2003,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_pop_history_stack(Eo *obj EINA_U
     }
   else
     {
-       last = _request_subchild_except(pd->root, node_get(obj, pd, last_focusable));
+       last = _request_subchild_except(pd->root, last_focusable);
        if (last)
          efl_ui_focus_manager_focus_set(obj, last->focusable);
     }