diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2019-10-28 13:49:55 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-10-28 14:07:17 -0400 |
commit | 62c557848b9513381857af8e910250dc9bf67a44 (patch) | |
tree | f5d810951954f93777eb70320aedbe198e59a960 | |
parent | 71b546efba025dae75faef7bc31be7e228399769 (diff) | |
download | efl-devs/zmike/genlist.tar.gz |
-rw-r--r-- | src/lib/elementary/elm_genlist.c | 29 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget_genlist.h | 1 | ||||
-rw-r--r-- | src/tests/ecore/ecore_test_timer.c | 47 |
3 files changed, 68 insertions, 9 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index 13e87fa5c6..40b644ea5d 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -469,7 +469,8 @@ _item_content_realize(Elm_Gen_Item *it, if (elm_widget_is(content)) { - if (!calc) + elm_widget_tree_unfocusable_set(content, it->item->unfocusable); + if (!calc && (!it->item->unfocusable)) _elm_widget_full_eval(content); } } @@ -1700,7 +1701,11 @@ _item_cache_find(Elm_Gen_Item *it) efl_wref_del(itc->base_view, &itc->base_view); itc->base_view = NULL; EINA_LIST_FREE(itc->contents, obj) - elm_widget_tree_unfocusable_set(obj, EINA_FALSE); + { + if (elm_widget_is(obj)) + elm_widget_tree_unfocusable_set(obj, it->item->unfocusable); + evas_object_show(obj); + } itc->contents = NULL; _item_cache_free(itc); return EINA_TRUE; @@ -1718,7 +1723,8 @@ _content_cache_add(Elm_Gen_Item *it, Eina_List **cache) { *cache = eina_list_append(*cache, content); eina_hash_del_by_key(pd->content_item_map, &content); - elm_widget_tree_unfocusable_set(content, EINA_TRUE); + if (elm_widget_is(content)) elm_widget_tree_unfocusable_set(content, EINA_TRUE); + evas_object_hide(content); } return *cache; @@ -5388,6 +5394,15 @@ _item_unrealize(Elm_Gen_Item *it) it->want_unrealize = EINA_FALSE; } +static void +_item_temp_realize(Elm_Gen_Item *it, const int index) +{ + it->item->unfocusable = EINA_TRUE; + _item_realize(it, index, EINA_TRUE); + _elm_genlist_item_unrealize(it, EINA_TRUE); + it->item->unfocusable = EINA_FALSE; +} + static Eina_Bool _item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd) { @@ -5421,8 +5436,7 @@ _item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd) { if (!size || (it->item->expanded_depth != size->expanded_depth)) { - _item_realize(it, blk_idx + vis_count, EINA_TRUE); - _elm_genlist_item_unrealize(it, EINA_TRUE); + _item_temp_realize(it, blk_idx + vis_count); } else { @@ -5443,10 +5457,7 @@ _item_block_recalc(Item_Block *itb, const int blk_idx, Eina_Bool qadd) it->item->mincalcd = EINA_TRUE; } else - { - _item_realize(it, blk_idx + vis_count, EINA_TRUE); - _elm_genlist_item_unrealize(it, EINA_TRUE); - } + _item_temp_realize(it, blk_idx + vis_count); } } else diff --git a/src/lib/elementary/elm_widget_genlist.h b/src/lib/elementary/elm_widget_genlist.h index 94b3b8465f..41aef7fa7e 100644 --- a/src/lib/elementary/elm_widget_genlist.h +++ b/src/lib/elementary/elm_widget_genlist.h @@ -253,6 +253,7 @@ struct Elm_Gen_Item_Type Eina_Bool queued : 1; Eina_Bool before : 1; Eina_Bool show_me : 1; + Eina_Bool unfocusable : 1; /* item is not focusable; propagate to content */ }; struct _Item_Block diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c index 06a648578b..b5b18f7e09 100644 --- a/src/tests/ecore/ecore_test_timer.c +++ b/src/tests/ecore/ecore_test_timer.c @@ -334,6 +334,52 @@ EFL_START_TEST(ecore_test_timer_iteration) } EFL_END_TEST +static Eina_Bool +_recursion() +{ + Ecore_Timer *timer; + /* verify multiple timer expiration in single mainloop iteration */ + ecore_timer_add(0, _timer_cb, (void *) 2); + ecore_timer_add(0, _timer_cb, (void *) 3); + ecore_main_loop_iterate(); + /* timers should not expire for one loop iteration */ + ck_assert_int_eq(count, 1); + ecore_timer_add(0, _timer_cb, (void *) 4); + ecore_main_loop_iterate(); + /* all pending and instantiated timers should expire after exactly one loop iteration */ + ck_assert_int_eq(count, 3); + ecore_main_loop_iterate(); + /* this should not interfere with successive timer processing */ + ck_assert_int_eq(count, 4); + + /* verify out-of-order timer processing solely based on timer times */ + timer = ecore_timer_add(1, _timer_cb, (void *) 6); + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 4); + ecore_timer_add(0, _timer_cb, (void *) 5); + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 4); + /* timer should expire after exactly 2 iterations */ + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 5); + ecore_timer_interval_set(timer, 0); + ecore_timer_reset(timer); + /* timer should expire after exactly 2 iterations since it becomes un-instantiated now */ + ecore_main_loop_iterate(); + ecore_main_loop_iterate(); + ck_assert_int_eq(count, 6); + return EINA_FALSE; +} + +EFL_START_TEST(ecore_test_timer_recursion) +{ + count = 1; + ecore_timer_add(0, _recursion, NULL); + ecore_main_loop_begin(); + ck_assert_int_eq(count, 6); +} +EFL_END_TEST + void ecore_test_timer(TCase *tc) { tcase_add_test(tc, ecore_test_timers); @@ -342,4 +388,5 @@ void ecore_test_timer(TCase *tc) tcase_add_test(tc, ecore_test_ecore_main_loop_timer); tcase_add_test(tc, ecore_test_timer_in_order); tcase_add_test(tc, ecore_test_timer_iteration); + tcase_add_test(tc, ecore_test_timer_recursion); } |