touchscreen: Respect list item selection size
Some lists have tall items that span more than one line of text, eg. the bookmark menu or ID3 tag menu. The touchscreen code didn't handle these menus correctly and touching on the lower part of a list item could select "between" two items, leading to incorrect rendering and behavior due to callers relying on the selected item being properly aligned to the selection size. Fix this by ensuring the touch code only generates properly aligned selections. Change-Id: I73945bb0947590517a005754bd447639e22812e2
This commit is contained in:
parent
b103b07503
commit
cdd1f90131
1 changed files with 6 additions and 2 deletions
|
@ -547,6 +547,8 @@ static bool swipe_scroll(struct gui_synclist * gui_list, int difference)
|
|||
gui_list->start_item[screen] = new_start_item;
|
||||
/* keep selected item in sync */
|
||||
gui_list->selected_item = new_start_item + selection_offset;
|
||||
if(gui_list->selected_size > 1)
|
||||
gui_list->selected_item -= (gui_list->selected_item % gui_list->selected_size);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -737,6 +739,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
|||
if (list_start_item+line >= list->nb_items)
|
||||
return ACTION_NONE;
|
||||
list->selected_item = list_start_item+line;
|
||||
if(list->selected_size > 1)
|
||||
list->selected_item -= (list->selected_item % list->selected_size);
|
||||
|
||||
gui_synclist_speak_item(list);
|
||||
}
|
||||
|
@ -754,7 +758,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
|||
if (click_loc & LIST)
|
||||
{
|
||||
/* held a single line for a while, bring up the context menu */
|
||||
gui_synclist_select_item(list, list_start_item + line);
|
||||
gui_synclist_select_item(list, list->selected_item);
|
||||
/* don't sent context repeatedly */
|
||||
action_wait_for_release();
|
||||
initial_touch = true;
|
||||
|
@ -766,7 +770,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
|
|||
initial_touch = true;
|
||||
if (click_loc & LIST)
|
||||
{ /* release on list item enters it */
|
||||
gui_synclist_select_item(list, list_start_item + line);
|
||||
gui_synclist_select_item(list, list->selected_item);
|
||||
return ACTION_STD_OK;
|
||||
}
|
||||
else if (click_loc & TITLE_TEXT)
|
||||
|
|
Loading…
Reference in a new issue