From 72b65a994d90daf3fec93158a5b18e6b1e8a6b0d Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 26 Nov 2018 17:30:19 +0100 Subject: [PATCH] efl_ui_focus_manager_root_focus: ensure that adapter is part of viewport This ensures that the adapter part is part of the viewport elements and border elements. This is done in order to support cases where a elm_scroller content is not focusable. Before the element was not correctly in viewport, and so not correctly registered. ref T6804 Differential Revision: https://phab.enlightenment.org/D7364 --- src/bin/elementary/test.c | 2 + src/bin/elementary/test_scroller.c | 44 ++++++++++++++++++++++ src/lib/elementary/efl_ui_focus_manager_calc.c | 9 +++-- .../elementary/efl_ui_focus_manager_root_focus.c | 4 +- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 4d01d96..f44052f 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -179,6 +179,7 @@ void test_scroller2(void *data, Evas_Object *obj, void *event_info); void test_scroller3(void *data, Evas_Object *obj, void *event_info); void test_scroller4(void *data, Evas_Object *obj, void *event_info); void test_scroller5(void *data, Evas_Object *obj, void *event_info); +void test_scroller6(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_scroller(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_scroller2(void *data, Evas_Object *obj, void *event_info); void test_spinner(void *data, Evas_Object *obj, void *event_info); @@ -1060,6 +1061,7 @@ add_tests: ADD_TEST(NULL, "Scroller", "Scroller 3", test_scroller3); ADD_TEST(NULL, "Scroller", "Page Scroller", test_scroller4); ADD_TEST(NULL, "Scroller", "Scroller on Popup", test_scroller5); + ADD_TEST(NULL, "Scroller", "Scroller 6", test_scroller6); ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller", test_efl_ui_scroller); //------------------------------// diff --git a/src/bin/elementary/test_scroller.c b/src/bin/elementary/test_scroller.c index a6670c6..ef8ef7e 100644 --- a/src/bin/elementary/test_scroller.c +++ b/src/bin/elementary/test_scroller.c @@ -1017,3 +1017,47 @@ test_scroller5(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event evas_object_resize(win, 400, 550); evas_object_show(win); } + +void +test_scroller6(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *win, *scr, *lb, *table, *btn, *btn2; + + win = elm_win_util_standard_add("Scroller with unfocusable content", "Scroller with unfocusable content"); + elm_win_autodel_set(win, EINA_TRUE); + elm_win_focus_highlight_enabled_set(win, EINA_TRUE); + + table = elm_table_add(win); + evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, table); + evas_object_show(table); + + scr = elm_scroller_add(win); + evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(scr, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_table_pack(table, scr, 0, 0, 1, 1); + evas_object_show(scr); + + lb = elm_label_add(scr); + elm_object_text_set(lb, "Enlightenment started out way back in 1996 as a project to build a Window Manager for X11. It has grown much more since then. Enlightenment still produces this Window Manager, but it has evolved to also cover Mobile, Wearable and TV UI requirements for projects such as Tizen as well as the traditional “desktop” UI. We still push out releases. See our download page for more details on the this. Visit our contribute page for our latest source code repositories. The project is currently transitioning from X11 to Wayland. We are fully committed to moving to Wayland eventually, as its the future of graphical display layers on Linux. We still primarily support Linux for Enlightenment, but there is some effort (based on help and support from users and some developers) to support BSD too."); + elm_object_content_set(scr, lb); + evas_object_show(lb); + + btn = elm_button_add(table); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.0); + elm_object_text_set(btn, "Button 2"); + elm_table_pack(table, btn, 0, 1, 2, 1); + evas_object_show(btn); + + btn2 = elm_button_add(table); + evas_object_size_hint_weight_set(btn2, 0.0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn2, 0.0, EVAS_HINT_FILL); + elm_object_text_set(btn2, "Button 3"); + elm_table_pack(table, btn2, 1, 0, 1, 1); + evas_object_show(btn2); + + evas_object_resize(win, 400, 550); + evas_object_show(win); +} diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index d6b5569..b22832e 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -243,8 +243,11 @@ node_item_free(Node *item) #define MAKE_LIST_DIRTY(node, field) \ EINA_LIST_FOREACH(DIRECTION_ACCESS(node, i).field, l, partner) \ { \ - dirty_add(obj, pd, partner); \ - dirty_added = EINA_TRUE; \ + if (partner->type != NODE_TYPE_ONLY_LOGICAL) \ + { \ + dirty_add(obj, pd, partner); \ + dirty_added = EINA_TRUE; \ + } \ } MAKE_LIST_DIRTY(item, one_direction) @@ -409,7 +412,7 @@ dirty_flush_node(Efl_Ui_Focus_Manager *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Cal static void dirty_flush(Efl_Ui_Focus_Manager *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *node) { - if (!pd->dirty) return; + if (!pd->dirty && node->type == NODE_TYPE_NORMAL) return; efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, NULL); diff --git a/src/lib/elementary/efl_ui_focus_manager_root_focus.c b/src/lib/elementary/efl_ui_focus_manager_root_focus.c index 0df8b5e..82eb1fb 100644 --- a/src/lib/elementary/efl_ui_focus_manager_root_focus.c +++ b/src/lib/elementary/efl_ui_focus_manager_root_focus.c @@ -180,7 +180,7 @@ _efl_ui_focus_manager_root_focus_canvas_object_set(Eo *obj, Efl_Ui_Focus_Manager if (pd->replacement_object) { - pd->iterator_list = eina_list_remove(pd->iterator_list, pd->replacement_object); + pd->iterator_list = eina_list_remove(pd->iterator_list, pd->rect); pd->replacement_object = NULL; } @@ -188,7 +188,7 @@ _efl_ui_focus_manager_root_focus_canvas_object_set(Eo *obj, Efl_Ui_Focus_Manager if (pd->replacement_object) { efl_ui_focus_composition_adapter_canvas_object_set(pd->rect, pd->replacement_object); - pd->iterator_list = eina_list_append(pd->iterator_list, pd->replacement_object); + pd->iterator_list = eina_list_append(pd->iterator_list, pd->rect); } } -- 2.7.4