From 37308192d908507a03712bd36974b4b2dec9ae6d Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Thu, 9 Aug 2018 10:52:55 +0200 Subject: [PATCH] efl_ui_focus_manager_calc: restore focus correctly if redirect gets NULL Otherwise we might end up with focus beeing NULL. Differential Revision: https://phab.enlightenment.org/D6803 --- .../elementary/efl_ui_focus_manager_calc.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index fb44889662..b36b2053e9 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -800,11 +800,22 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_redirect_set(Eo *obj, Efl_Ui_Foc n = eina_list_last_data_get(pd->focus_stack); - if (n) + if (!pd->redirect && old_manager) { - if (!pd->redirect && old_manager) - efl_ui_focus_object_focus_set(n->focusable, EINA_TRUE); - else if (pd->redirect && !old_manager) + if (n) + { + efl_ui_focus_object_focus_set(n->focusable, EINA_TRUE); + } + else + { + n = _request_subchild(pd->root); + if (n) + efl_ui_focus_manager_focus_set(obj, n->focusable); + } + } + else if (pd->redirect && !old_manager) + { + if (n) efl_ui_focus_object_focus_set(n->focusable, EINA_FALSE); } }