[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: touchscreen: handle scrollbar properly when UI viewport is used
From: rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () cool ! haxx ! se>
Date: 2021-08-22 14:45:28
Message-ID: 202108221445.17MEjS75888016 () stuffed ! shaftnet ! org
[Download RAW message or body]
commit 569b165cff2330c5c7dfd6b1aa175008729b4414
Author: Aidan MacDonald <amachronic@protonmail.com>
Date: Sat Aug 21 10:28:52 2021 +0100
touchscreen: handle scrollbar properly when UI viewport is used
Change-Id: I3b55233f4d50f5b8ae38f9f337ebdee6f93ad44e
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 2b5a99fb9f..db8e0504d7 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -359,8 +359,7 @@ static enum {
SCROLL_KINETIC, /* state after releasing swipe */
} scroll_mode;
-static int scrollbar_scroll(struct gui_synclist * gui_list,
- int y)
+static int scrollbar_scroll(struct gui_synclist * gui_list, int y)
{
const int screen = screens[SCREEN_MAIN].screen_type;
const int nb_lines = list_get_nb_lines(gui_list, screen);
@@ -369,11 +368,9 @@ static int scrollbar_scroll(struct gui_synclist * gui_list,
{
/* scrollbar scrolling is still line based */
y_offset = 0;
- int scrollbar_size = nb_lines*gui_list->line_height[screen];
+ int scrollbar_size = nb_lines * gui_list->line_height[screen];
int actual_y = y - list_text[screen].y;
-
- int new_selection = (actual_y * gui_list->nb_items)
- / scrollbar_size;
+ int new_selection = (actual_y * gui_list->nb_items) / scrollbar_size;
int start_item = new_selection - nb_lines/2;
if(start_item < 0)
@@ -839,7 +836,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
hide_selection = true;
/* similarly to swipe scroll, using the scrollbar grabs
* focus so the click location is irrelevant */
- scrollbar_scroll(list, adj_y);
+ scrollbar_scroll(list, y);
if (action & BUTTON_REL)
scroll_mode = SCROLL_NONE;
break;
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
https://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic