summaryrefslogtreecommitdiffstats
path: root/apps/gui/list.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-10-31 11:11:46 +0000
committerThomas Martitz <kugel@rockbox.org>2010-10-31 11:11:46 +0000
commitb673ae2c46129d6994b61a351a1567c56f4aef82 (patch)
tree4253dd1daa90384e3f87443f497453c265cbbb0f /apps/gui/list.c
parenteaff333bf526225cfca84cd686fe5332b852e506 (diff)
downloadrockbox-b673ae2c46129d6994b61a351a1567c56f4aef82.tar.gz
rockbox-b673ae2c46129d6994b61a351a1567c56f4aef82.tar.bz2
rockbox-b673ae2c46129d6994b61a351a1567c56f4aef82.zip
FS#11686 - Kinetic list scrolling for touchscreen
This adds kinetic scrolling to to lists on touchscreen targets and RaaA, like all other OSes on touchscreens have. It's only enabled in the absolute point mode, so for non-touchscreen and in grid mode nothing changes. Kinetic scrolling means that the list keeps scrolling (but is decelerating) after you leave the touchscreen with the finger. Redraw interval and deceleration is hardcoded for now but could be made configurable if desired. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28408 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r--apps/gui/list.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 70b04c4313..61738fd454 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -550,6 +550,7 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists)
}
#endif /* HAVE_LCD_BITMAP */
+
bool gui_synclist_do_button(struct gui_synclist * lists,
int *actionptr, enum list_wrap wrap)
{
@@ -563,32 +564,38 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
#else
static int next_item_modifier = 1;
static int last_accel_tick = 0;
- if (global_settings.list_accel_start_delay)
- {
- int start_delay = global_settings.list_accel_start_delay * (HZ/2);
- int accel_wait = global_settings.list_accel_wait * HZ/2;
- if (get_action_statuscode(NULL)&ACTION_REPEAT)
+ if (action != ACTION_TOUCHSCREEN)
+ {
+ if (global_settings.list_accel_start_delay)
{
- if (!last_accel_tick)
- last_accel_tick = current_tick + start_delay;
- else if (TIME_AFTER(current_tick, last_accel_tick + accel_wait))
+ int start_delay = global_settings.list_accel_start_delay * (HZ/2);
+ int accel_wait = global_settings.list_accel_wait * HZ/2;
+
+ if (get_action_statuscode(NULL)&ACTION_REPEAT)
{
- last_accel_tick = current_tick;
- next_item_modifier++;
+ if (!last_accel_tick)
+ last_accel_tick = current_tick + start_delay;
+ else if (TIME_AFTER(current_tick, last_accel_tick + accel_wait))
+ {
+ last_accel_tick = current_tick;
+ next_item_modifier++;
+ }
+ }
+ else if (last_accel_tick)
+ {
+ next_item_modifier = 1;
+ last_accel_tick = 0;
}
- }
- else if (last_accel_tick)
- {
- next_item_modifier = 1;
- last_accel_tick = 0;
}
}
#endif
-
#if defined(HAVE_TOUCHSCREEN)
if (action == ACTION_TOUCHSCREEN)
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();
#endif
switch (wrap)