summaryrefslogtreecommitdiff
path: root/apps/gui/bitmap
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-08-10 23:21:41 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-08-10 23:33:00 +0100
commitcdd1f901313a15d13531aecf85b97bc668af4793 (patch)
tree8bcbfe6179c7597a77195eaaa6ee73f83b24cb13 /apps/gui/bitmap
parentb103b075034d74550bc77e8af4ba6f2b4e8a65df (diff)
downloadrockbox-cdd1f901313a15d13531aecf85b97bc668af4793.tar.gz
rockbox-cdd1f901313a15d13531aecf85b97bc668af4793.zip
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
Diffstat (limited to 'apps/gui/bitmap')
-rw-r--r--apps/gui/bitmap/list.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index a82595fb37..2b5a99fb9f 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -547,6 +547,8 @@ static bool swipe_scroll(struct gui_synclist * gui_list, int difference)
547 gui_list->start_item[screen] = new_start_item; 547 gui_list->start_item[screen] = new_start_item;
548 /* keep selected item in sync */ 548 /* keep selected item in sync */
549 gui_list->selected_item = new_start_item + selection_offset; 549 gui_list->selected_item = new_start_item + selection_offset;
550 if(gui_list->selected_size > 1)
551 gui_list->selected_item -= (gui_list->selected_item % gui_list->selected_size);
550 } 552 }
551 553
552 return true; 554 return true;
@@ -737,6 +739,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
737 if (list_start_item+line >= list->nb_items) 739 if (list_start_item+line >= list->nb_items)
738 return ACTION_NONE; 740 return ACTION_NONE;
739 list->selected_item = list_start_item+line; 741 list->selected_item = list_start_item+line;
742 if(list->selected_size > 1)
743 list->selected_item -= (list->selected_item % list->selected_size);
740 744
741 gui_synclist_speak_item(list); 745 gui_synclist_speak_item(list);
742 } 746 }
@@ -754,7 +758,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
754 if (click_loc & LIST) 758 if (click_loc & LIST)
755 { 759 {
756 /* held a single line for a while, bring up the context menu */ 760 /* held a single line for a while, bring up the context menu */
757 gui_synclist_select_item(list, list_start_item + line); 761 gui_synclist_select_item(list, list->selected_item);
758 /* don't sent context repeatedly */ 762 /* don't sent context repeatedly */
759 action_wait_for_release(); 763 action_wait_for_release();
760 initial_touch = true; 764 initial_touch = true;
@@ -766,7 +770,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
766 initial_touch = true; 770 initial_touch = true;
767 if (click_loc & LIST) 771 if (click_loc & LIST)
768 { /* release on list item enters it */ 772 { /* release on list item enters it */
769 gui_synclist_select_item(list, list_start_item + line); 773 gui_synclist_select_item(list, list->selected_item);
770 return ACTION_STD_OK; 774 return ACTION_STD_OK;
771 } 775 }
772 else if (click_loc & TITLE_TEXT) 776 else if (click_loc & TITLE_TEXT)