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) | |
download | rockbox-d1653bc4d89592f07206ad8f5b711fcf7d58a92d.tar.gz rockbox-d1653bc4d89592f07206ad8f5b711fcf7d58a92d.zip |
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, | |||
152 | gui_list->callback_speak_item = NULL; | 152 | gui_list->callback_speak_item = NULL; |
153 | gui_list->nb_items = 0; | 153 | gui_list->nb_items = 0; |
154 | gui_list->selected_item = 0; | 154 | gui_list->selected_item = 0; |
155 | #ifdef HAVE_TOUCHSCREEN | ||
156 | gui_list->y_pos = 0; | ||
157 | #endif | ||
155 | FOR_NB_SCREENS(i) | 158 | FOR_NB_SCREENS(i) |
156 | { | 159 | { |
157 | gui_list->start_item[i] = 0; | 160 | gui_list->start_item[i] = 0; |
@@ -282,6 +285,9 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, | |||
282 | gui_list->start_item[screen] = bottom; | 285 | gui_list->start_item[screen] = bottom; |
283 | else | 286 | else |
284 | gui_list->start_item[screen] = new_start_item; | 287 | gui_list->start_item[screen] = new_start_item; |
288 | #ifdef HAVE_TOUCHSCREEN | ||
289 | gui_list->y_pos = gui_list->start_item[SCREEN_MAIN] * gui_list->line_height[SCREEN_MAIN]; | ||
290 | #endif | ||
285 | } | 291 | } |
286 | 292 | ||
287 | static void edge_beep(struct gui_synclist * gui_list, bool wrap) | 293 | 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, | |||
417 | gui_list->selected_size); | 423 | gui_list->selected_size); |
418 | gui_list->selected_item = gui_list->start_item[i] + nb_lines; | 424 | gui_list->selected_item = gui_list->start_item[i] + nb_lines; |
419 | } | 425 | } |
426 | |||
427 | #ifdef HAVE_TOUCHSCREEN | ||
428 | gui_list->y_pos = gui_list->start_item[SCREEN_MAIN] * gui_list->line_height[SCREEN_MAIN]; | ||
429 | #endif | ||
420 | } | 430 | } |
421 | return; | 431 | return; |
422 | } | 432 | } |
@@ -667,7 +677,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, | |||
667 | action = *actionptr = gui_synclist_do_touchscreen(lists); | 677 | action = *actionptr = gui_synclist_do_touchscreen(lists); |
668 | else if (action > ACTION_TOUCHSCREEN_MODE) | 678 | else if (action > ACTION_TOUCHSCREEN_MODE) |
669 | /* cancel kinetic if we got a normal button event */ | 679 | /* cancel kinetic if we got a normal button event */ |
670 | _gui_synclist_stop_kinetic_scrolling(); | 680 | _gui_synclist_stop_kinetic_scrolling(lists); |
671 | #endif | 681 | #endif |
672 | 682 | ||
673 | /* Disable the skin redraw callback */ | 683 | /* Disable the skin redraw callback */ |