From 0dd8ba4725a03cadb5724a9555d6add1f07dc913 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 26 Sep 2010 07:32:16 +0000 Subject: Fix FS#11552 - touches outside of the UI viewport can do unexpected list movements. Also remove naughty // comments from r28145 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28168 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/bitmap/list.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 1af2dfc8ae..6ce8972944 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -372,14 +372,14 @@ static int gui_synclist_touchscreen_scrolling(struct gui_synclist * gui_list, in const int screen = screens[SCREEN_MAIN].screen_type; const int difference = position - last_position; const int nb_lines = viewport_get_nb_lines(&list_text[screen]); - if(nb_lines < gui_list->nb_items && difference != 0) // only scroll if needed + if(nb_lines < gui_list->nb_items && difference != 0) /* only scroll if needed */ { int new_start_item; new_start_item = gui_list->start_item[screen] - difference; - // check if new_start_item is bigger than list item count + /* check if new_start_item is bigger than list item count */ if(new_start_item > gui_list->nb_items - nb_lines) new_start_item = gui_list->nb_items - nb_lines; - // set new_start_item to 0 if it's negative + /* set new_start_item to 0 if it's negative */ if(new_start_item < 0) new_start_item = 0; gui_list->start_item[screen] = new_start_item; @@ -397,6 +397,10 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) const bool old_released = released; int line, list_width = list_text_vp->width; + /* make sure it is inside the UI viewport */ + if (!viewport_point_within_vp(sb_skin_get_info_vp(screen), x, y)) + return BUTTON_NONE; + released = (button&BUTTON_REL) != 0; if (global_settings.scrollbar == SCROLLBAR_RIGHT) @@ -408,7 +412,6 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) if (x > list_text_vp->x + list_width) return ACTION_NONE; - /* make sure it is inside the UI viewport */ if (list_display_title(gui_list, screen) && viewport_point_within_vp(&title_text[screen], x, y) && button == BUTTON_REL && scroll_mode == SCROLL_NONE) @@ -517,7 +520,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) scroll_mode = SCROLL_NONE; redraw = true; } - + /* select current item */ gui_synclist_select_item(gui_list, list_start_item+line); if (last_position == 0) -- cgit v1.2.3