summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-11-10 15:25:15 +0000
committerThomas Martitz <kugel@rockbox.org>2010-11-10 15:25:15 +0000
commit33af0dec28cf31be0ce7195b90546861efcce76f (patch)
treef106c9118c9191bff00e1468c98540787081c0e8 /apps
parente134021e1b05f797cffd28c6b4ee72a963ff3812 (diff)
downloadrockbox-33af0dec28cf31be0ce7195b90546861efcce76f.tar.gz
rockbox-33af0dec28cf31be0ce7195b90546861efcce76f.tar.bz2
rockbox-33af0dec28cf31be0ce7195b90546861efcce76f.zip
Touchscreen: Improved scroll threshold
Remove the hardcoded (and way too small) scroll threshold (the distance moved in pixels before we think the users wants to scroll) and replace it with something based on the actual DPI of the screen. On Android we call the API for that, on other touchscreens we reimplemented Android's formula (as of 2.2) and calculate it. Flyspray: 11727 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28548 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/bitmap/list.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 26e15e7978..268209e1c1 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -486,16 +486,26 @@ void _gui_synclist_stop_kinetic_scrolling(void)
* otherwise it returns true even if it didn't actually scroll,
* but scrolling mode shouldn't be changed
**/
+
+
+static int scroll_begin_threshold;
+static int threshold_accumulation;
static bool swipe_scroll(struct gui_synclist * gui_list, int line_height, int difference)
{
/* fixme */
const enum screen_type screen = screens[SCREEN_MAIN].screen_type;
const int nb_lines = viewport_get_nb_lines(&list_text[screen]);
+ if (UNLIKELY(scroll_begin_threshold == 0))
+ scroll_begin_threshold = touchscreen_get_scroll_threshold();
+
/* make selecting items easier */
- if (abs(difference) < SCROLL_BEGIN_THRESHOLD && scroll_mode == SCROLL_NONE)
+ threshold_accumulation += abs(difference);
+ if (threshold_accumulation < scroll_begin_threshold && scroll_mode == SCROLL_NONE)
return false;
+ threshold_accumulation = 0;
+
/* does the list even scroll? if no, return but still show
* the caller that we would scroll */
if (nb_lines >= gui_list->nb_items)