bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=97ec48434f59c18c5fb60a9f9eed394c82fb5f91

commit 97ec48434f59c18c5fb60a9f9eed394c82fb5f91
Author: Marcel Hollerbach <[email protected]>
Date:   Sat Jan 27 13:00:04 2018 +0100

    efl_ui_focus_manager_calc: keep the entry for the redirect seperated
    
    logicals on the focus stack can cause there a lot of confusion.
    
    This fixes a missed focus out event from the entry in elementary_test
---
 src/lib/elementary/efl_ui_focus_manager_calc.c | 36 ++++++++++++++++----------
 1 file changed, 22 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 600deea46c..8880e9f3ad 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -73,6 +73,7 @@ typedef struct {
     Eina_List *focus_stack;
     Eina_Hash *node_hash;
     Efl_Ui_Focus_Manager *redirect;
+    Efl_Ui_Focus_Manager *redirect_entry;
     Eina_List *dirty;
 
     Node *root;
@@ -996,6 +997,10 @@ _efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, 
Efl_Ui_Focus_Manager_
    //delete again from the list, for the case it was not at the top
    pd->focus_stack = eina_list_remove(pd->focus_stack, node);
 
+   //if this is the entry for redirect, NULL them out!
+   if (pd->redirect_entry == node->focusable)
+     pd->redirect_entry = NULL;
+
    if (refocus)
      {
         Node *n = eina_list_last_data_get(pd->focus_stack);
@@ -1042,16 +1047,6 @@ 
_efl_ui_focus_manager_calc_efl_ui_focus_manager_redirect_set(Eo *obj, Efl_Ui_Foc
 
    efl_ui_focus_manager_reset_history(old_manager);
 
-   //we might have saved a logical element at the top, remove that if there is 
one
-   {
-      Node *n = NULL;
-
-      n = eina_list_last_data_get(pd->focus_stack);
-
-      if (n && n->type == NODE_TYPE_ONLY_LOGICAL && n->redirect_manager == 
old_manager)
-        pd->focus_stack = eina_list_remove(pd->focus_stack, n);
-   }
-
    //adjust focus property of the most upper element
    {
       Node *n = NULL;
@@ -1569,8 +1564,20 @@ 
_efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_set(Eo *obj, Efl_U
      last_focusable = last->focusable;
 
    //remove the object from the list and add it again
-   pd->focus_stack = eina_list_remove(pd->focus_stack, node);
-   pd->focus_stack = eina_list_append(pd->focus_stack, node);
+   if (node_type == NODE_TYPE_NORMAL)
+     {
+        pd->focus_stack = eina_list_remove(pd->focus_stack, node);
+        pd->focus_stack = eina_list_append(pd->focus_stack, node);
+     }
+
+   //capture how we came to the redirect manager
+   if (redirect_manager)
+     {
+        pd->redirect_entry = new_focusable;
+     }
+
+   //set to NULL here, from the event earlier this pointer could be dead.
+   node = NULL;
 
    //unset redirect manager for the case that its a different one to the one 
we want
    if (pd->redirect && pd->redirect != redirect_manager)
@@ -1587,8 +1594,7 @@ 
_efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_set(Eo *obj, Efl_U
           }
      }
 
-   //set to NULL here, from the event earlier this pointer could be dead.
-   node = NULL;
+
 
    /*
      Only emit those signals if we are already at the top of the focus stack.
@@ -1773,6 +1779,8 @@ 
_efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_get(Eo *obj EINA_U
 {
    Node *upper = NULL;
 
+   if (pd->redirect && pd->redirect_entry) return pd->redirect_entry;
+
    upper = eina_list_last_data_get(pd->focus_stack);
 
    if (!upper)

-- 


Reply via email to