efl_ui_focus_manager_calc: maintain focus when focused element is

unregistered

this should fix T6216.
This commit is contained in:
Marcel Hollerbach 2017-10-16 09:55:53 +02:00
parent 124586c8e4
commit 45b4cdee19
1 changed files with 15 additions and 0 deletions

View File

@ -784,6 +784,7 @@ EOLIAN static void
_efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *child)
{
Node *node;
Eina_Bool refocus = EINA_FALSE;
node = eina_hash_find(pd->node_hash, &child);
@ -791,6 +792,13 @@ _efl_ui_focus_manager_calc_unregister(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_
F_DBG("Manager: %p unregister %p", obj, child);
if (eina_list_last_data_get(pd->focus_stack) == node)
{
//unfocus the current head
efl_ui_focus_object_focus_set(child, EINA_FALSE);
refocus = EINA_TRUE;
}
//remove the object from the stack if it hasn't done that until now
//after this it's not at the top anymore
@ -798,6 +806,13 @@ _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 (refocus)
{
Node *n = eina_list_last_data_get(pd->focus_stack);
if (n)
efl_ui_focus_object_focus_set(n->focusable, EINA_TRUE);
}
//add all neighbors of the node to the dirty list
for(int i = EFL_UI_FOCUS_DIRECTION_UP; i < NODE_DIRECTIONS_COUNT; i++)
{