diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2012-03-20 21:27:33 +1100 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2012-03-20 22:10:19 +1100 |
commit | 94139ac0bd3e1ca5d384ac8ac5ad2a915d633a82 (patch) | |
tree | 46d24ce01ca9a04dbacb08fa090ba4705c3040f0 | |
parent | 287bf712474494590013b4055cb1e8b6cd45e661 (diff) | |
download | rockbox-94139ac0bd3e1ca5d384ac8ac5ad2a915d633a82.tar.gz rockbox-94139ac0bd3e1ca5d384ac8ac5ad2a915d633a82.zip |
Fix FS#12606 - next track can cause the screen to be cleared
This is a bit of a hack. We now trigger an event when the skin engine
is doing a full redraw (which means fullscreen clear) before the
lcd_update() to give the current screen a chance to redraw to avoid the
screen flicker.
This commit fixes the issue for screens which are entirely the list
widget (i.e browser and menus), other screens will need aditional fixes
(i.e quickscreen, time&date screen)
Change-Id: I3725c51518be724ce7aacee9877663c2de6866fa
-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 { | |||
61 | GUI_EVENT_STATUSBAR_TOGGLE = (EVENT_CLASS_GUI|1), | 61 | GUI_EVENT_STATUSBAR_TOGGLE = (EVENT_CLASS_GUI|1), |
62 | GUI_EVENT_ACTIONUPDATE, | 62 | GUI_EVENT_ACTIONUPDATE, |
63 | GUI_EVENT_THEME_CHANGED, | 63 | GUI_EVENT_THEME_CHANGED, |
64 | /* Called when the UI viewport is cleared in the skin engine to | ||
65 | * notify the current screen that it needs to do an update */ | ||
66 | GUI_EVENT_NEED_UI_UPDATE, | ||
64 | }; | 67 | }; |
65 | 68 | ||
66 | /** Recording events **/ | 69 | /** 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) | |||
596 | } | 596 | } |
597 | #endif | 597 | #endif |
598 | 598 | ||
599 | /* | ||
600 | * Magic to make sure the list gets updated correctly if the skin does | ||
601 | * something naughty like a full screen update when we are in a button | ||
602 | * loop. | ||
603 | * | ||
604 | * The GUI_EVENT_NEED_UI_UPDATE event is registered for in list_do_action_timeout() | ||
605 | * and unregistered in gui_synclict_do_button(). This is done because | ||
606 | * if something is using the list UI they *must* be calling those | ||
607 | * two functions in the correct order or the list wont work. | ||
608 | */ | ||
609 | static struct gui_synclist *current_lists; | ||
610 | static bool ui_update_event_registered = false; | ||
611 | void _lists_uiviewport_update_callback(void *data) | ||
612 | { | ||
613 | (void)data; | ||
614 | if (current_lists) | ||
615 | gui_synclist_draw(current_lists); | ||
616 | } | ||
617 | |||
599 | bool gui_synclist_do_button(struct gui_synclist * lists, | 618 | bool gui_synclist_do_button(struct gui_synclist * lists, |
600 | int *actionptr, enum list_wrap wrap) | 619 | int *actionptr, enum list_wrap wrap) |
601 | { | 620 | { |
@@ -643,6 +662,9 @@ bool gui_synclist_do_button(struct gui_synclist * lists, | |||
643 | _gui_synclist_stop_kinetic_scrolling(); | 662 | _gui_synclist_stop_kinetic_scrolling(); |
644 | #endif | 663 | #endif |
645 | 664 | ||
665 | /* Disable the skin redraw callback */ | ||
666 | current_lists = NULL; | ||
667 | |||
646 | switch (wrap) | 668 | switch (wrap) |
647 | { | 669 | { |
648 | case LIST_WRAP_ON: | 670 | case LIST_WRAP_ON: |
@@ -772,6 +794,14 @@ int list_do_action_timeout(struct gui_synclist *lists, int timeout) | |||
772 | /* Returns the lowest of timeout or the delay until a postponed | 794 | /* Returns the lowest of timeout or the delay until a postponed |
773 | scheduled announcement is due (if any). */ | 795 | scheduled announcement is due (if any). */ |
774 | { | 796 | { |
797 | if (lists != current_lists) | ||
798 | { | ||
799 | if (!ui_update_event_registered) | ||
800 | ui_update_event_registered = | ||
801 | add_event(GUI_EVENT_NEED_UI_UPDATE, false, | ||
802 | _lists_uiviewport_update_callback); | ||
803 | current_lists = lists; | ||
804 | } | ||
775 | if(lists->scheduled_talk_tick) | 805 | if(lists->scheduled_talk_tick) |
776 | { | 806 | { |
777 | long delay = lists->scheduled_talk_tick -current_tick +1; | 807 | 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 @@ | |||
29 | #include "config.h" | 29 | #include "config.h" |
30 | #include "core_alloc.h" | 30 | #include "core_alloc.h" |
31 | #include "kernel.h" | 31 | #include "kernel.h" |
32 | #include "appevents.h" | ||
32 | #ifdef HAVE_ALBUMART | 33 | #ifdef HAVE_ALBUMART |
33 | #include "albumart.h" | 34 | #include "albumart.h" |
34 | #endif | 35 | #endif |
@@ -884,6 +885,13 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
884 | display->set_framebuffer(NULL); | 885 | display->set_framebuffer(NULL); |
885 | skin_backdrop_show(data->backdrop_id); | 886 | skin_backdrop_show(data->backdrop_id); |
886 | #endif | 887 | #endif |
888 | |||
889 | if (((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL)) | ||
890 | { | ||
891 | /* If this is the UI viewport then let the UI know | ||
892 | * to redraw itself */ | ||
893 | send_event(GUI_EVENT_NEED_UI_UPDATE, NULL); | ||
894 | } | ||
887 | /* Restore the default viewport */ | 895 | /* Restore the default viewport */ |
888 | display->set_viewport(NULL); | 896 | display->set_viewport(NULL); |
889 | display->update(); | 897 | display->update(); |