bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fa9aff8f70a183453c04084c9e064548fa7ef5f4
commit fa9aff8f70a183453c04084c9e064548fa7ef5f4 Author: Marcel Hollerbach <[email protected]> Date: Sun May 6 18:14:11 2018 +0200 efl_ui_focus_manager_calc: do not restore focus when redirect is set When there is a redirect there is no need to adjust the focus property based on a unregister, so just continue and cleanup the history. When the redirect is unset the focus is restored. fix T6908 --- src/lib/elementary/efl_ui_focus_manager_calc.c | 2 +- src/tests/elementary/elm_test_focus.c | 35 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index 2360c266e4..e6fdd4a7e5 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -733,7 +733,7 @@ _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) + if (eina_list_last_data_get(pd->focus_stack) == node && !pd->redirect) { if (!efl_invalidated_get(pd->root->focusable)) { diff --git a/src/tests/elementary/elm_test_focus.c b/src/tests/elementary/elm_test_focus.c index 449100ca95..dfde01d650 100644 --- a/src/tests/elementary/elm_test_focus.c +++ b/src/tests/elementary/elm_test_focus.c @@ -930,6 +930,40 @@ EFL_START_TEST(test_request_move) } EFL_END_TEST +EFL_START_TEST(redirect_unregister_entrypoint) +{ + Efl_Ui_Focus_Manager *m, *m2; + + TEST_OBJ_NEW(root, 0, 20, 20, 20); + TEST_OBJ_NEW(root2, 0, 20, 20, 20); + TEST_OBJ_NEW(child, 0, 20, 20, 20); + TEST_OBJ_NEW(child2, 0, 20, 20, 20); + TEST_OBJ_NEW(child3, 0, 20, 20, 20); + + m = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, efl_main_loop_get(), + efl_ui_focus_manager_root_set(efl_added, root) + ); + + m2 = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, efl_main_loop_get(), + efl_ui_focus_manager_root_set(efl_added, root2) + ); + + + efl_ui_focus_manager_calc_register(m2, child3, root2, m2); + + efl_ui_focus_manager_calc_register(m, child, root, m2); + efl_ui_focus_manager_calc_register(m, child2, root, NULL); + efl_ui_focus_manager_focus_set(m, child); + + ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2); + efl_ui_focus_manager_calc_unregister(m, child); + ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2); + ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), NULL); + + efl_del(m); + efl_del(m2); +} +EFL_END_TEST void elm_test_focus(TCase *tc) { @@ -960,4 +994,5 @@ void elm_test_focus(TCase *tc) tcase_add_test(tc, test_unregister_last_focused_no_child); tcase_add_test(tc, test_pop_history_element); tcase_add_test(tc, test_request_move); + tcase_add_test(tc, redirect_unregister_entrypoint); } --
