From fbf83dc4ce939c06808c874d6ac1cc3926fedd50 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Thu, 21 Oct 2021 23:11:32 +0200 Subject: Add setting for disabling wrap-around lists Allows user to decide whether scrolling lists will wrap around to the opposite end after the first or last item has been reached. Change-Id: I22156812cf4c857ddc4b6c48c1cef013b1985260 --- apps/menus/display_menu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apps/menus') diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index c72fb08fae..7a4d81284a 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -351,6 +351,22 @@ MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view, MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL); MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL); +static int listwraparound_callback(int action, + const struct menu_item_ex *this_item, + struct gui_synclist *this_list) +{ + (void)this_item; + switch (action) + { + case ACTION_EXIT_MENUITEM: + gui_synclist_limit_scroll(this_list, !global_settings.list_wraparound); + break; + } + return action; +} + +MENUITEM_SETTING(list_wraparound, &global_settings.list_wraparound, listwraparound_callback); + MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, &scroll_speed, &scroll_delay, &scroll_step, @@ -360,6 +376,7 @@ MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON, #endif &offset_out_of_view, &screen_scroll_step, &scroll_paginated, + &list_wraparound, #ifndef HAVE_WHEEL_ACCELERATION &list_accel_start_delay, &list_accel_wait #endif -- cgit v1.2.3