efl_ui_focus_manager_calc: check if we are already focused earlier
authorMarcel Hollerbach <marcel@osg.samsung.com>
Tue, 17 Oct 2017 17:30:15 +0000 (19:30 +0200)
committerMarcel Hollerbach <marcel@osg.samsung.com>
Thu, 19 Oct 2017 08:04:59 +0000 (10:04 +0200)
if we dont do that we may unset a redirect just to set the same redirect
again.

src/lib/elementary/efl_ui_focus_manager_calc.c

index 88cdcf7..6921de5 100644 (file)
@@ -1246,7 +1246,6 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
    Efl_Ui_Focus_Manager *redirect_manager;
    Eo *focusable;
    Node_Type type;
-   Eina_Bool was_redirect = EINA_FALSE;
 
    EINA_SAFETY_ON_NULL_RETURN(focus);
 
@@ -1291,6 +1290,13 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
           }
      }
 
+   if (eina_list_last_data_get(pd->focus_stack) == node)
+     {
+        //the correct one is focused
+        if (node->redirect_manager == pd->redirect)
+          return;
+     }
+
    if (pd->redirect)
      {
         //reset the history of that manager
@@ -1298,9 +1304,6 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
 
         //first unset the redirect
         efl_ui_focus_manager_redirect_set(obj, NULL);
-
-        //we have been redirecting
-        was_redirect = EINA_TRUE;
      }
 
    redirect_manager = node->redirect_manager;
@@ -1313,9 +1316,6 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
         //check if this is already the focused object
         old_focus = eina_list_last_data_get(pd->focus_stack);
 
-        //check if this is already at the top
-        if (!was_redirect && old_focus && old_focus->focusable == focus) return;
-
         //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);