(Ozone) Ensure sidebar display status is updated correctly when performing rapid menu navigation (#12524)

This commit is contained in:
jdgleaver 2021-06-14 12:58:39 +01:00 committed by GitHub
parent 6738fa57aa
commit 642d6c9fb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 19 deletions

View File

@ -726,6 +726,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
ozone->animations.thumbnail_bar_position = 0.0f;
ozone->show_thumbnail_bar = false;
ozone->pending_hide_thumbnail_bar = false;
ozone->dimensions_sidebar_width = 0.0f;
ozone->num_search_terms_old = 0;
@ -3288,6 +3289,15 @@ static void ozone_list_open(ozone_handle_t *ozone, settings_t *settings)
/* Sidebar animation */
ozone_sidebar_update_collapse(ozone, settings, true);
/* Kill any existing sidebar slide-in/out animations
* before pushing a new one
* > This is required since the 'ozone_collapse_end'
* callback from an unfinished slide-out animation
* may subsequently override the 'draw_sidebar'
* value set at the beginning of the next slide-in
* animation... */
gfx_animation_kill_by_tag(&sidebar_tag);
if (ozone->depth == 1)
{
ozone->draw_sidebar = true;

View File

@ -298,6 +298,7 @@ struct ozone_handle
bool cursor_mode;
bool sidebar_collapsed;
bool show_thumbnail_bar;
bool pending_hide_thumbnail_bar;
bool fullscreen_thumbnails_available;
bool show_fullscreen_thumbnails;
bool selection_core_is_viewer;

View File

@ -163,6 +163,7 @@ static void ozone_thumbnail_bar_hide_end(void *userdata)
{
ozone_handle_t *ozone = (ozone_handle_t*) userdata;
ozone->show_thumbnail_bar = false;
ozone->pending_hide_thumbnail_bar = false;
}
static void ozone_draw_no_thumbnail_available(
@ -437,8 +438,23 @@ void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist,
gfx_animation_kill_by_tag(&tag);
/* Show it */
if (is_playlist && !ozone->cursor_in_sidebar && !ozone->show_thumbnail_bar && ozone->depth == 1)
/* Show it
* > We only want to trigger a 'show' animation
* if 'show_thumbnail_bar' is currently false.
* However: 'show_thumbnail_bar' is only set
* to false by the 'ozone_thumbnail_bar_hide_end'
* callback. If the above 'gfx_animation_kill_by_tag()'
* kills an existing 'hide' animation, then the
* callback will not fire - so the sidebar will be
* off screen, but a subsequent attempt to show it
* here will fail, since 'show_thumbnail_bar' will
* be a false positive. We therefore require an
* additional 'pending_hide_thumbnail_bar' parameter
* to track mid-animation state changes... */
if (is_playlist &&
!ozone->cursor_in_sidebar &&
(!ozone->show_thumbnail_bar || ozone->pending_hide_thumbnail_bar) &&
(ozone->depth == 1))
{
if (allow_animation)
{
@ -455,6 +471,8 @@ void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist,
ozone->animations.thumbnail_bar_position = ozone->dimensions.thumbnail_bar_width;
ozone->show_thumbnail_bar = true;
}
ozone->pending_hide_thumbnail_bar = false;
}
/* Hide it */
else
@ -465,6 +483,7 @@ void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist,
entry.userdata = ozone;
entry.target_value = 0.0f;
ozone->pending_hide_thumbnail_bar = true;
gfx_animation_push(&entry);
}
else

View File

@ -752,6 +752,7 @@ void ozone_refresh_sidebars(
ozone->animations.thumbnail_bar_position = 0.0f;
ozone->show_thumbnail_bar = false;
}
ozone->pending_hide_thumbnail_bar = false;
/* If sidebar is on-screen, update scroll position */
if (ozone->depth == 1)