gui: Remove gui_synclist_item_is_onscreen()

Only the "Rockbox Info" screen uses it for a rather silly purpose,
so remove the function. This helps to decouple things from the GUI.

Change-Id: Icf73e3ee1230c75bf43016c0f1c05c7fe1a24895
This commit is contained in:
Aidan MacDonald 2022-09-20 13:27:51 +01:00
parent 1c5a0497cf
commit e57b4f9099
3 changed files with 1 additions and 11 deletions

View file

@ -800,13 +800,6 @@ bool list_do_action(int context, int timeout,
return gui_synclist_do_button(lists, action); return gui_synclist_do_button(lists, action);
} }
bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
enum screen_type screen, int item)
{
int nb_lines = list_get_nb_lines(lists, screen);
return (unsigned)(item - lists->start_item[screen]) < (unsigned) nb_lines;
}
/* Simple use list implementation */ /* Simple use list implementation */
static int simplelist_line_count = 0, simplelist_line_remaining; static int simplelist_line_count = 0, simplelist_line_remaining;
static int simplelist_line_pos; static int simplelist_line_pos;

View file

@ -220,8 +220,6 @@ extern void gui_synclist_add_item(struct gui_synclist * lists);
extern void gui_synclist_del_item(struct gui_synclist * lists); extern void gui_synclist_del_item(struct gui_synclist * lists);
extern void gui_synclist_set_title(struct gui_synclist * lists, const char * title, extern void gui_synclist_set_title(struct gui_synclist * lists, const char * title,
enum themable_icons icon); enum themable_icons icon);
extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
enum screen_type screen, int item);
extern bool gui_synclist_keyclick_callback(int action, void* data); extern bool gui_synclist_keyclick_callback(int action, void* data);
/* /*

View file

@ -441,8 +441,7 @@ static int info_action_callback(int action, struct gui_synclist *lists)
else if (action == ACTION_NONE) else if (action == ACTION_NONE)
{ {
static int last_redraw = 0; static int last_redraw = 0;
if (gui_synclist_item_is_onscreen(lists, 0, INFO_TIME) if (TIME_AFTER(current_tick, last_redraw + HZ*5))
&& TIME_AFTER(current_tick, last_redraw + HZ*5))
{ {
last_redraw = current_tick; last_redraw = current_tick;
return ACTION_REDRAW; return ACTION_REDRAW;