efl_ui_spotlight_container: reverse push and pop semantics

before this commit, push would add before the current element, pop would
return to the next higher element.
after this commit, push would add after the current element, pop would
return to the previous element.

ref T7991

Differential Revision: https://phab.enlightenment.org/D10781
This commit is contained in:
Marcel Hollerbach 2019-12-03 11:48:56 +01:00
parent 7787b16e20
commit d973bcc087
2 changed files with 8 additions and 8 deletions

View File

@ -716,12 +716,12 @@ _efl_ui_spotlight_container_push(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EI
{
if (efl_ui_spotlight_active_element_get(obj))
{
if (!efl_pack_before(obj, view, efl_ui_spotlight_active_element_get(obj)))
if (!efl_pack_after(obj, view, efl_ui_spotlight_active_element_get(obj)))
return;
}
else
{
if (!efl_pack_begin(obj, view))
if (!efl_pack_end(obj, view))
return;
}
@ -769,9 +769,9 @@ _efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Ei
return efl_loop_future_resolved(obj, v);
}
new_index = efl_pack_index_get(obj, efl_ui_spotlight_active_element_get(obj)) + 1;
if (new_index >= count)
new_index -= 2;
new_index = efl_pack_index_get(obj, efl_ui_spotlight_active_element_get(obj)) - 1;
if (new_index < 0)
new_index += 2;
pd->transition_done.content = content;
pd->transition_done.transition_done = efl_loop_promise_new(obj);

View File

@ -540,8 +540,8 @@ EFL_START_TEST (efl_ui_spotlight_test_push1)
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_spotlight_push(container, w);
ck_assert_int_eq(efl_pack_index_get(container, w), 0);
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 0));
ck_assert_int_eq(efl_pack_index_get(container, w), 1);
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 1));
}
EFL_END_TEST
@ -556,7 +556,7 @@ EFL_START_TEST (efl_ui_spotlight_test_push2)
}
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
efl_ui_spotlight_push(container, w);
ck_assert_int_eq(efl_pack_index_get(container, w), 3);
ck_assert_int_eq(efl_pack_index_get(container, w), 4);
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
}
EFL_END_TEST