forked from len0rd/rockbox
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
This commit is contained in:
parent
e134021e1b
commit
33af0dec28
13 changed files with 115 additions and 3 deletions
|
|
@ -35,6 +35,8 @@ static jmethodID java_lcd_update;
|
|||
static jmethodID java_lcd_update_rect;
|
||||
|
||||
static bool display_on;
|
||||
static int dpi;
|
||||
static int scroll_threshold;
|
||||
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
|
|
@ -77,6 +79,20 @@ void lcd_init_device(void)
|
|||
RockboxFramebuffer_class,
|
||||
"java_lcd_update_rect",
|
||||
"(IIII)V");
|
||||
|
||||
jmethodID get_dpi = e->GetMethodID(env_ptr,
|
||||
RockboxFramebuffer_class,
|
||||
"getDpi", "()I");
|
||||
|
||||
jmethodID get_scroll_threshold
|
||||
= e->GetMethodID(env_ptr,
|
||||
RockboxFramebuffer_class,
|
||||
"getScrollThreshold", "()I");
|
||||
|
||||
dpi = e->CallIntMethod(env_ptr, RockboxFramebuffer_instance,
|
||||
get_dpi);
|
||||
scroll_threshold = e->CallIntMethod(env_ptr, RockboxFramebuffer_instance,
|
||||
get_scroll_threshold);
|
||||
display_on = true;
|
||||
}
|
||||
|
||||
|
|
@ -101,6 +117,16 @@ bool lcd_active(void)
|
|||
return display_on;
|
||||
}
|
||||
|
||||
int lcd_get_dpi(void)
|
||||
{
|
||||
return dpi;
|
||||
}
|
||||
|
||||
int touchscreen_get_scroll_threshold(void)
|
||||
{
|
||||
return scroll_threshold;
|
||||
}
|
||||
|
||||
/*
|
||||
* (un)block lcd updates.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue