diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index c5dfd931c8..8af7431940 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -621,6 +621,7 @@ bool menu_iterate(void) { first_held = false; rgui->trigger_state = input_state; + rgui->scroll_accel = min(rgui->scroll_accel + 1, 64); } initial_held = false; @@ -629,6 +630,7 @@ bool menu_iterate(void) { first_held = false; initial_held = true; + rgui->scroll_accel = 0; } rgui->delay_count++; diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index ed40b50839..c5139e647b 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -290,6 +290,7 @@ typedef struct // Rebuilt when parsing directory. size_t scroll_indices[2 * (26 + 2) + 1]; unsigned scroll_indices_size; + unsigned scroll_accel; char base_path[PATH_MAX]; char default_glslp[PATH_MAX]; diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index 14f11043f1..be851b2994 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -1111,32 +1111,34 @@ static int rgui_iterate(void *data, unsigned action) if (rgui->need_refresh && action != RGUI_ACTION_MESSAGE) action = RGUI_ACTION_NOOP; + unsigned scroll_speed = (max(rgui->scroll_accel, 4) - 4) / 4 + 1; + switch (action) { case RGUI_ACTION_UP: - if (rgui->selection_ptr > 0) - rgui->selection_ptr--; + if (rgui->selection_ptr >= scroll_speed) + rgui->selection_ptr -= scroll_speed; else rgui->selection_ptr = rgui->selection_buf->size - 1; break; case RGUI_ACTION_DOWN: - if (rgui->selection_ptr + 1 < rgui->selection_buf->size) - rgui->selection_ptr++; + if (rgui->selection_ptr + scroll_speed < rgui->selection_buf->size) + rgui->selection_ptr += scroll_speed; else rgui->selection_ptr = 0; break; case RGUI_ACTION_LEFT: - if (rgui->selection_ptr > 8) - rgui->selection_ptr -= 8; + if (rgui->selection_ptr > 8 * scroll_speed) + rgui->selection_ptr -= 8 * scroll_speed; else rgui->selection_ptr = 0; break; case RGUI_ACTION_RIGHT: - if (rgui->selection_ptr + 8 < rgui->selection_buf->size) - rgui->selection_ptr += 8; + if (rgui->selection_ptr + 8 * scroll_speed < rgui->selection_buf->size) + rgui->selection_ptr += 8 * scroll_speed; else rgui->selection_ptr = rgui->selection_buf->size - 1; break;