summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2023-11-24 16:17:33 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2023-11-24 16:17:33 -0500
commitb6ce98c55c31039fdc8189b4cbe0bb7e56eaf894 (patch)
tree30163c508e0c9708775a21dfb831e7f8bd5c222c
parentcb3b5397b34eb6ad181b2c9d32996152f28d3974 (diff)
downloadrockbox-b6ce98c55c.tar.gz
rockbox-b6ce98c55c.zip
[BugFix] yesno screen disappears
sending GUI_EVENT_NEED_UI_UPDATE ensured we got redrawn but it also sometimes resulted in the yesno screen being overdrawn depending on which event callback was called last now increasing the update frequency, clear the dirty bit on whatever vp we are replacing and well as call our redraw function instead of sending UI_UPDATE also found a potential bug in get_font() Change-Id: I1da6defa6db799a4778590daa0c107aba00a9d34
-rw-r--r--apps/gui/yesno.c25
-rw-r--r--firmware/font.c2
2 files changed, 13 insertions, 14 deletions
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index 6056d239a6..a0fd908727 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -88,7 +88,7 @@ static void gui_yesno_draw(struct gui_yesno * yn)
enum yesno_res def_res = yn->tmo_default_res;
long end_tick = yn->end_tick;
- last_vp = display->set_viewport(vp);
+ last_vp = display->set_viewport_ex(vp, VP_FLAG_VP_SET_CLEAN);
display->clear_viewport();
nb_lines = yn->main_message->nb_lines;
vp_lines = viewport_get_nb_lines(vp);
@@ -182,9 +182,10 @@ static bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result)
const struct text_message * message=yn->result_message[result];
struct viewport *vp = yn->vp;
struct screen * display=yn->display;
+ struct viewport *last_vp = display->set_viewport_ex(vp, VP_FLAG_VP_SET_CLEAN);
+
if(message==NULL)
return false;
- struct viewport *last_vp = display->set_viewport(vp);
display->clear_viewport();
put_message(yn->display, message, 0, viewport_get_nb_lines(vp));
display->update_viewport();
@@ -223,21 +224,16 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
{
int button;
int result=-1;
- bool result_displayed;
+ bool result_displayed = false;
struct gui_yesno yn[NB_SCREENS];
struct viewport vp[NB_SCREENS];
long talked_tick = 0;
long end_tick = current_tick + ticks;
- long button_scan_tmo;
+ long button_scan_tmo = HZ/2;
- if (ticks >= HZ) /* Display a prompt with timeout to the user */
- {
- button_scan_tmo = HZ/2;
- }
- else
+ if (ticks < HZ) /* Display a prompt with NO timeout to the user */
{
tmo_default_res = YESNO_TMO;
- button_scan_tmo = HZ*5;
}
FOR_NB_SCREENS(i)
@@ -278,7 +274,8 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
talked_tick = current_tick;
talk_text_message(main_message, false);
}
- send_event(GUI_EVENT_NEED_UI_UPDATE, NULL);
+ FOR_NB_SCREENS(i)
+ gui_yesno_draw(&yn[i]);
button = get_action(CONTEXT_YESNOSCREEN, button_scan_tmo);
@@ -340,12 +337,14 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
: no_message, false);
talk_force_enqueue_next();
}
- if(result_displayed)
- sleep(HZ);
+
exit:
remove_event_ex(GUI_EVENT_NEED_UI_UPDATE, gui_yesno_ui_update, &yn[0]);
+ if(result_displayed)
+ sleep(HZ);
+
FOR_NB_SCREENS(i)
{
screens[i].scroll_stop_viewport(yn[i].vp);
diff --git a/firmware/font.c b/firmware/font.c
index 1644201f67..baaec13d3c 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -699,7 +699,7 @@ struct font* font_get(int font)
struct font* pf;
if (font == FONT_UI)
font = MAXFONTS-1;
- if (font <= FONT_SYSFIXED)
+ if (font <= FONT_SYSFIXED || font >= MAXFONTS)
return &sysfont;
while (1) {