diff options
-rw-r--r-- | apps/appevents.h | 3 | ||||
-rw-r--r-- | apps/gui/list.c | 30 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 8 |
3 files changed, 41 insertions, 0 deletions
diff --git a/apps/appevents.h b/apps/appevents.h index 36e19b0df7..5cb0ee57b2 100644 --- a/apps/appevents.h +++ b/apps/appevents.h @@ -61,6 +61,9 @@ enum { GUI_EVENT_STATUSBAR_TOGGLE = (EVENT_CLASS_GUI|1), GUI_EVENT_ACTIONUPDATE, GUI_EVENT_THEME_CHANGED, + /* Called when the UI viewport is cleared in the skin engine to + * notify the current screen that it needs to do an update */ + GUI_EVENT_NEED_UI_UPDATE, }; /** Recording events **/ diff --git a/apps/gui/list.c b/apps/gui/list.c index d1b2748a60..5af4501b45 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -596,6 +596,25 @@ bool gui_synclist_keyclick_callback(int action, void* data) } #endif +/* + * Magic to make sure the list gets updated correctly if the skin does + * something naughty like a full screen update when we are in a button + * loop. + * + * The GUI_EVENT_NEED_UI_UPDATE event is registered for in list_do_action_timeout() + * and unregistered in gui_synclict_do_button(). This is done because + * if something is using the list UI they *must* be calling those + * two functions in the correct order or the list wont work. + */ +static struct gui_synclist *current_lists; +static bool ui_update_event_registered = false; +void _lists_uiviewport_update_callback(void *data) +{ + (void)data; + if (current_lists) + gui_synclist_draw(current_lists); +} + bool gui_synclist_do_button(struct gui_synclist * lists, int *actionptr, enum list_wrap wrap) { @@ -643,6 +662,9 @@ bool gui_synclist_do_button(struct gui_synclist * lists, _gui_synclist_stop_kinetic_scrolling(); #endif + /* Disable the skin redraw callback */ + current_lists = NULL; + switch (wrap) { case LIST_WRAP_ON: @@ -772,6 +794,14 @@ int list_do_action_timeout(struct gui_synclist *lists, int timeout) /* Returns the lowest of timeout or the delay until a postponed scheduled announcement is due (if any). */ { + if (lists != current_lists) + { + if (!ui_update_event_registered) + ui_update_event_registered = + add_event(GUI_EVENT_NEED_UI_UPDATE, false, + _lists_uiviewport_update_callback); + current_lists = lists; + } if(lists->scheduled_talk_tick) { long delay = lists->scheduled_talk_tick -current_tick +1; diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 0a1759d91a..23b22bcdfa 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c @@ -29,6 +29,7 @@ #include "config.h" #include "core_alloc.h" #include "kernel.h" +#include "appevents.h" #ifdef HAVE_ALBUMART #include "albumart.h" #endif @@ -884,6 +885,13 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) display->set_framebuffer(NULL); skin_backdrop_show(data->backdrop_id); #endif + + if (((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL)) + { + /* If this is the UI viewport then let the UI know + * to redraw itself */ + send_event(GUI_EVENT_NEED_UI_UPDATE, NULL); + } /* Restore the default viewport */ display->set_viewport(NULL); display->update(); |