summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-30 16:57:36 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-05-30 16:58:53 +0200
commit2f28d0c593ee302c79ec3c25eb8626472917bcac (patch)
treee4b05848288c9e942a46dc3f7912f01bee88cb34
parent65deb248e3849851943b2f5c693c7e2a2e909f69 (diff)
efl_ui_active_view: update index accordingly
Summary: The -1 here only worked for cases where we delete widgets at position 0. When we are deleting something then we need to stay in the virtual position where the view is right now, but *then* we need to animate again into the direction where have real content. This commit ensures that this is the case fix T7989 Depends on D9056 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7989 Differential Revision: https://phab.enlightenment.org/D9055
-rw-r--r--src/lib/elementary/efl_ui_active_view_container.c6
-rw-r--r--src/lib/elementary/efl_ui_active_view_view_manager_stack.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_active_view_container.c b/src/lib/elementary/efl_ui_active_view_container.c
index 7a264691e8..d1f2fcc9b6 100644
--- a/src/lib/elementary/efl_ui_active_view_container.c
+++ b/src/lib/elementary/efl_ui_active_view_container.c
@@ -500,6 +500,7 @@ _unpack(Eo *obj,
500 int index) 500 int index)
501{ 501{
502 int early_curr_page = pd->curr.page; 502 int early_curr_page = pd->curr.page;
503 Eina_Bool deletion_of_active = (index == pd->curr.page);
503 504
504 pd->content_list = eina_list_remove(pd->content_list, subobj); 505 pd->content_list = eina_list_remove(pd->content_list, subobj);
505 _elm_widget_sub_object_redirect_to_top(obj, subobj); 506 _elm_widget_sub_object_redirect_to_top(obj, subobj);
@@ -516,7 +517,10 @@ _unpack(Eo *obj,
516 if (pd->gravity == EFL_UI_ACTIVE_VIEW_CONTAINER_GRAVITY_CONTENT && early_curr_page == index) 517 if (pd->gravity == EFL_UI_ACTIVE_VIEW_CONTAINER_GRAVITY_CONTENT && early_curr_page == index)
517 { 518 {
518 int new_curr_page = MIN(MAX(early_curr_page, 0), (int)eina_list_count(pd->content_list) - 1); 519 int new_curr_page = MIN(MAX(early_curr_page, 0), (int)eina_list_count(pd->content_list) - 1);
519 pd->curr.page = -1; 520 //when we delete the active index and we are not updating the index,
521 // then force a update, so the same sort of animation is triggered from the right direction
522 if (deletion_of_active && new_curr_page == pd->curr.page)
523 pd->curr.page = index -1;
520 if (eina_list_count(pd->content_list) > 0 && efl_alive_get(obj)) 524 if (eina_list_count(pd->content_list) > 0 && efl_alive_get(obj))
521 efl_ui_active_view_active_index_set(obj, new_curr_page); 525 efl_ui_active_view_active_index_set(obj, new_curr_page);
522 } 526 }
diff --git a/src/lib/elementary/efl_ui_active_view_view_manager_stack.c b/src/lib/elementary/efl_ui_active_view_view_manager_stack.c
index ad2038a0be..769540d590 100644
--- a/src/lib/elementary/efl_ui_active_view_view_manager_stack.c
+++ b/src/lib/elementary/efl_ui_active_view_view_manager_stack.c
@@ -179,13 +179,22 @@ _setup_anim(Efl_Animation_Player *player, Efl_Gfx_Entity *entity)
179 efl_player_start(player); 179 efl_player_start(player);
180} 180}
181 181
182static Eina_Bool
183is_valid(Eo *obj, int index)
184{
185 if (index < 0) return EINA_FALSE;
186 if (index >= efl_content_count(obj)) return EINA_FALSE;
187
188 return EINA_TRUE;
189}
190
182EOLIAN static void 191EOLIAN static void
183_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, int from, int to) 192_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, int from, int to)
184{ 193{
185 if (efl_pack_content_get(pd->container, to) == pd->content) 194 if (efl_pack_content_get(pd->container, to) == pd->content)
186 return; 195 return;
187 196
188 if (from != -1) 197 if (is_valid(pd->container, to) && is_valid(pd->container, from))
189 { 198 {
190 if (pd->animation) 199 if (pd->animation)
191 { 200 {