diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-22 01:46:28 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-08-22 14:57:54 +0000 |
commit | d1653bc4d89592f07206ad8f5b711fcf7d58a92d (patch) | |
tree | b721d43277b8c3ebdd49aca524507c7b10bd053f /apps/gui/list.c | |
parent | 569b165cff2330c5c7dfd6b1aa175008729b4414 (diff) |
touchscreen: fix smooth scrolling in lists
This fixes those annoying jumps that happen when you hit the end of
a list while scrolling.
Change-Id: I2e41111f9415dce1692b52a2600e7ce77c8f0291
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 139dbaac18..13a850bd7b 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -152,6 +152,9 @@ void gui_synclist_init(struct gui_synclist * gui_list, gui_list->callback_speak_item = NULL; gui_list->nb_items = 0; gui_list->selected_item = 0; +#ifdef HAVE_TOUCHSCREEN + gui_list->y_pos = 0; +#endif FOR_NB_SCREENS(i) { gui_list->start_item[i] = 0; @@ -282,6 +285,9 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, gui_list->start_item[screen] = bottom; else gui_list->start_item[screen] = new_start_item; +#ifdef HAVE_TOUCHSCREEN + gui_list->y_pos = gui_list->start_item[SCREEN_MAIN] * gui_list->line_height[SCREEN_MAIN]; +#endif } static void edge_beep(struct gui_synclist * gui_list, bool wrap) @@ -417,6 +423,10 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, gui_list->selected_size); gui_list->selected_item = gui_list->start_item[i] + nb_lines; } + +#ifdef HAVE_TOUCHSCREEN + gui_list->y_pos = gui_list->start_item[SCREEN_MAIN] * gui_list->line_height[SCREEN_MAIN]; +#endif } return; } @@ -667,7 +677,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, action = *actionptr = gui_synclist_do_touchscreen(lists); else if (action > ACTION_TOUCHSCREEN_MODE) /* cancel kinetic if we got a normal button event */ - _gui_synclist_stop_kinetic_scrolling(); + _gui_synclist_stop_kinetic_scrolling(lists); #endif /* Disable the skin redraw callback */ |