diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-10-31 11:11:46 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-10-31 11:11:46 +0000 |
commit | b673ae2c46129d6994b61a351a1567c56f4aef82 (patch) | |
tree | 4253dd1daa90384e3f87443f497453c265cbbb0f /apps/gui/list.c | |
parent | eaff333bf526225cfca84cd686fe5332b852e506 (diff) | |
download | rockbox-b673ae2c46129d6994b61a351a1567c56f4aef82.tar.gz 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.c | 39 |
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) | |||
550 | } | 550 | } |
551 | #endif /* HAVE_LCD_BITMAP */ | 551 | #endif /* HAVE_LCD_BITMAP */ |
552 | 552 | ||
553 | |||
553 | bool gui_synclist_do_button(struct gui_synclist * lists, | 554 | bool gui_synclist_do_button(struct gui_synclist * lists, |
554 | int *actionptr, enum list_wrap wrap) | 555 | int *actionptr, enum list_wrap wrap) |
555 | { | 556 | { |
@@ -563,32 +564,38 @@ bool gui_synclist_do_button(struct gui_synclist * lists, | |||
563 | #else | 564 | #else |
564 | static int next_item_modifier = 1; | 565 | static int next_item_modifier = 1; |
565 | static int last_accel_tick = 0; | 566 | static int last_accel_tick = 0; |
566 | if (global_settings.list_accel_start_delay) | ||
567 | { | ||
568 | int start_delay = global_settings.list_accel_start_delay * (HZ/2); | ||
569 | int accel_wait = global_settings.list_accel_wait * HZ/2; | ||
570 | 567 | ||
571 | if (get_action_statuscode(NULL)&ACTION_REPEAT) | 568 | if (action != ACTION_TOUCHSCREEN) |
569 | { | ||
570 | if (global_settings.list_accel_start_delay) | ||
572 | { | 571 | { |
573 | if (!last_accel_tick) | 572 | int start_delay = global_settings.list_accel_start_delay * (HZ/2); |
574 | last_accel_tick = current_tick + start_delay; | 573 | int accel_wait = global_settings.list_accel_wait * HZ/2; |
575 | else if (TIME_AFTER(current_tick, last_accel_tick + accel_wait)) | 574 | |
575 | if (get_action_statuscode(NULL)&ACTION_REPEAT) | ||
576 | { | 576 | { |
577 | last_accel_tick = current_tick; | 577 | if (!last_accel_tick) |
578 | next_item_modifier++; | 578 | last_accel_tick = current_tick + start_delay; |
579 | else if (TIME_AFTER(current_tick, last_accel_tick + accel_wait)) | ||
580 | { | ||
581 | last_accel_tick = current_tick; | ||
582 | next_item_modifier++; | ||
583 | } | ||
584 | } | ||
585 | else if (last_accel_tick) | ||
586 | { | ||
587 | next_item_modifier = 1; | ||
588 | last_accel_tick = 0; | ||
579 | } | 589 | } |
580 | } | ||
581 | else if (last_accel_tick) | ||
582 | { | ||
583 | next_item_modifier = 1; | ||
584 | last_accel_tick = 0; | ||
585 | } | 590 | } |
586 | } | 591 | } |
587 | #endif | 592 | #endif |
588 | |||
589 | #if defined(HAVE_TOUCHSCREEN) | 593 | #if defined(HAVE_TOUCHSCREEN) |
590 | if (action == ACTION_TOUCHSCREEN) | 594 | if (action == ACTION_TOUCHSCREEN) |
591 | action = *actionptr = gui_synclist_do_touchscreen(lists); | 595 | action = *actionptr = gui_synclist_do_touchscreen(lists); |
596 | else if (action > ACTION_TOUCHSCREEN_MODE) | ||
597 | /* cancel kinetic if we got a normal button event */ | ||
598 | _gui_synclist_stop_kinetic_scrolling(); | ||
592 | #endif | 599 | #endif |
593 | 600 | ||
594 | switch (wrap) | 601 | switch (wrap) |