mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
touchscreen: Fix kinetic and swipe scrolling outside of the list viewport.
There were some bugs, especially when the user scrolled above the list viewport. One bug made Rockbox completely unusable once triggered. Change-Id: I9bb4722ff4381db189058e9a19ea30b2c69e87d9
This commit is contained in:
parent
9b7edbf609
commit
2ffde90c69
1 changed files with 61 additions and 59 deletions
|
@ -732,7 +732,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
||||||
short x, y;
|
short x, y;
|
||||||
int action, adj_x, adj_y, line, line_height, list_start_item;
|
int action, adj_x, adj_y, line, line_height, list_start_item;
|
||||||
bool recurse;
|
bool recurse;
|
||||||
static int last_y = -1;
|
static bool initial_touch = true;
|
||||||
|
static int last_y;
|
||||||
|
|
||||||
screen = SCREEN_MAIN;
|
screen = SCREEN_MAIN;
|
||||||
parent = list->parent[screen];
|
parent = list->parent[screen];
|
||||||
|
@ -752,15 +753,17 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
||||||
{
|
{
|
||||||
case SCROLL_NONE:
|
case SCROLL_NONE:
|
||||||
{
|
{
|
||||||
if (last_y == -1)
|
int click_loc;
|
||||||
{ /* first run. register adj_y and re-run (will then take the else case) */
|
if (initial_touch)
|
||||||
last_y = adj_y;
|
|
||||||
recurse = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
int click_loc = get_click_location(list, x, y);
|
/* on the first touch last_y has to be reset to avoid
|
||||||
|
* glitches with touches from long ago */
|
||||||
|
last_y = adj_y;
|
||||||
|
initial_touch = false;
|
||||||
|
}
|
||||||
|
|
||||||
line = 0; /* silence gcc 'used uninitialized' warning */
|
line = 0; /* silence gcc 'used uninitialized' warning */
|
||||||
|
click_loc = get_click_location(list, x, y);
|
||||||
if (click_loc & LIST)
|
if (click_loc & LIST)
|
||||||
{
|
{
|
||||||
if(!skinlist_get_item(&screens[screen], list, adj_x, adj_y, &line))
|
if(!skinlist_get_item(&screens[screen], list, adj_x, adj_y, &line))
|
||||||
|
@ -793,13 +796,13 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
||||||
gui_synclist_select_item(list, list_start_item + line);
|
gui_synclist_select_item(list, list_start_item + line);
|
||||||
/* don't sent context repeatedly */
|
/* don't sent context repeatedly */
|
||||||
action_wait_for_release();
|
action_wait_for_release();
|
||||||
last_y = -1;
|
initial_touch = true;
|
||||||
return ACTION_STD_CONTEXT;
|
return ACTION_STD_CONTEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action & BUTTON_REL)
|
else if (action & BUTTON_REL)
|
||||||
{
|
{
|
||||||
last_y = -1;
|
initial_touch = true;
|
||||||
if (click_loc & LIST)
|
if (click_loc & LIST)
|
||||||
{ /* release on list item enters it */
|
{ /* release on list item enters it */
|
||||||
gui_synclist_select_item(list, list_start_item + line);
|
gui_synclist_select_item(list, list_start_item + line);
|
||||||
|
@ -814,7 +817,6 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
||||||
return ACTION_STD_MENU;
|
return ACTION_STD_MENU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCROLL_SWIPE:
|
case SCROLL_SWIPE:
|
||||||
|
@ -842,7 +844,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
||||||
scroll_mode = SCROLL_NONE;
|
scroll_mode = SCROLL_NONE;
|
||||||
|
|
||||||
if (scroll_mode == SCROLL_NONE)
|
if (scroll_mode == SCROLL_NONE)
|
||||||
last_y = -1;
|
initial_touch = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCROLL_KINETIC:
|
case SCROLL_KINETIC:
|
||||||
|
@ -879,8 +881,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register y position unless forcefully reset to 1- */
|
/* register y position unless forcefully reset */
|
||||||
if (last_y >= 0)
|
if (!initial_touch)
|
||||||
last_y = adj_y;
|
last_y = adj_y;
|
||||||
|
|
||||||
return recurse ? gui_synclist_do_touchscreen(list) : ACTION_REDRAW;
|
return recurse ? gui_synclist_do_touchscreen(list) : ACTION_REDRAW;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue