forked from len0rd/rockbox
Touchscreen fixes:
* better handling of clicks/taps above the list itself (which results in exiting the current menu) * fix 'entering the first item when clicking on the empty space below a list which has less items than a full screen can handle' git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20046 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
856fda013e
commit
21ca86646f
1 changed files with 16 additions and 24 deletions
|
|
@ -282,7 +282,6 @@ void list_draw(struct screen *display, struct gui_synclist *list)
|
||||||
display->set_viewport(NULL);
|
display->set_viewport(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_TOUCHSCREEN)
|
#if defined(HAVE_TOUCHSCREEN)
|
||||||
/* This needs to be fixed if we ever get more than 1 touchscreen on a target.
|
/* This needs to be fixed if we ever get more than 1 touchscreen on a target.
|
||||||
* This also assumes the whole screen is used, which is a bad assumption but
|
* This also assumes the whole screen is used, which is a bad assumption but
|
||||||
|
|
@ -354,28 +353,28 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
|
||||||
if (y > list_text[screen].y || button & BUTTON_REPEAT)
|
if (y > list_text[screen].y || button & BUTTON_REPEAT)
|
||||||
{
|
{
|
||||||
int line_height, actual_y;
|
int line_height, actual_y;
|
||||||
static int last_y = 0;
|
|
||||||
|
|
||||||
actual_y = y - list_text[screen].y;
|
actual_y = y - list_text[screen].y;
|
||||||
line_height = font_get(gui_list->parent[screen]->font)->height;
|
line_height = font_get(gui_list->parent[screen]->font)->height;
|
||||||
line = actual_y / line_height;
|
line = actual_y / line_height;
|
||||||
|
|
||||||
if(actual_y%line_height == 0) /* Pressed a border */
|
/* Pressed below the list*/
|
||||||
|
if (gui_list->start_item[screen]+line >= gui_list->nb_items)
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
|
|
||||||
if (gui_list->start_item[screen]+line > gui_list->nb_items)
|
/* Pressed a border */
|
||||||
{
|
if(UNLIKELY(actual_y % line_height == 0))
|
||||||
/* Pressed below the list*/
|
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
}
|
|
||||||
last_y = actual_y;
|
if (line != (gui_list->selected_item - gui_list->start_item[screen])
|
||||||
if (line != gui_list->selected_item
|
&& button ^ BUTTON_REL)
|
||||||
- gui_list->start_item[screen] && button ^ BUTTON_REL)
|
|
||||||
{
|
{
|
||||||
if(button & BUTTON_REPEAT)
|
if(button & BUTTON_REPEAT)
|
||||||
scrolling = true;
|
scrolling = true;
|
||||||
|
|
||||||
gui_synclist_select_item(gui_list, gui_list->start_item[screen]
|
gui_synclist_select_item(gui_list, gui_list->start_item[screen]
|
||||||
+ line);
|
+ line);
|
||||||
|
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -399,7 +398,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(button == BUTTON_REL)
|
else if(button == BUTTON_REL &&
|
||||||
|
line == gui_list->selected_item - gui_list->start_item[screen])
|
||||||
{
|
{
|
||||||
/* Pen was released on either the same line as the previously
|
/* Pen was released on either the same line as the previously
|
||||||
* selected one or an other one
|
* selected one or an other one
|
||||||
|
|
@ -410,18 +410,10 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
|
||||||
else
|
else
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
}
|
}
|
||||||
/* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */
|
/* Everything above the items is cancel */
|
||||||
else if (y > title_text[screen].y && draw_title(display, gui_list)
|
else if (y < list_text[screen].y && button == BUTTON_REL)
|
||||||
&& button == BUTTON_REL)
|
|
||||||
{
|
|
||||||
return ACTION_STD_CANCEL;
|
return ACTION_STD_CANCEL;
|
||||||
}
|
}
|
||||||
/* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */
|
|
||||||
else if (global_settings.statusbar && button == BUTTON_REL)
|
|
||||||
{
|
|
||||||
return ACTION_STD_CANCEL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue