diff options
-rw-r--r-- | apps/gui/bitmap/list.c | 13 |
1 files changed, 8 insertions, 5 deletions
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 | |||
372 | const int screen = screens[SCREEN_MAIN].screen_type; | 372 | const int screen = screens[SCREEN_MAIN].screen_type; |
373 | const int difference = position - last_position; | 373 | const int difference = position - last_position; |
374 | const int nb_lines = viewport_get_nb_lines(&list_text[screen]); | 374 | const int nb_lines = viewport_get_nb_lines(&list_text[screen]); |
375 | if(nb_lines < gui_list->nb_items && difference != 0) // only scroll if needed | 375 | if(nb_lines < gui_list->nb_items && difference != 0) /* only scroll if needed */ |
376 | { | 376 | { |
377 | int new_start_item; | 377 | int new_start_item; |
378 | new_start_item = gui_list->start_item[screen] - difference; | 378 | new_start_item = gui_list->start_item[screen] - difference; |
379 | // check if new_start_item is bigger than list item count | 379 | /* check if new_start_item is bigger than list item count */ |
380 | if(new_start_item > gui_list->nb_items - nb_lines) | 380 | if(new_start_item > gui_list->nb_items - nb_lines) |
381 | new_start_item = gui_list->nb_items - nb_lines; | 381 | new_start_item = gui_list->nb_items - nb_lines; |
382 | // set new_start_item to 0 if it's negative | 382 | /* set new_start_item to 0 if it's negative */ |
383 | if(new_start_item < 0) | 383 | if(new_start_item < 0) |
384 | new_start_item = 0; | 384 | new_start_item = 0; |
385 | gui_list->start_item[screen] = new_start_item; | 385 | gui_list->start_item[screen] = new_start_item; |
@@ -397,6 +397,10 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) | |||
397 | const bool old_released = released; | 397 | const bool old_released = released; |
398 | int line, list_width = list_text_vp->width; | 398 | int line, list_width = list_text_vp->width; |
399 | 399 | ||
400 | /* make sure it is inside the UI viewport */ | ||
401 | if (!viewport_point_within_vp(sb_skin_get_info_vp(screen), x, y)) | ||
402 | return BUTTON_NONE; | ||
403 | |||
400 | released = (button&BUTTON_REL) != 0; | 404 | released = (button&BUTTON_REL) != 0; |
401 | 405 | ||
402 | if (global_settings.scrollbar == SCROLLBAR_RIGHT) | 406 | if (global_settings.scrollbar == SCROLLBAR_RIGHT) |
@@ -408,7 +412,6 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) | |||
408 | if (x > list_text_vp->x + list_width) | 412 | if (x > list_text_vp->x + list_width) |
409 | return ACTION_NONE; | 413 | return ACTION_NONE; |
410 | 414 | ||
411 | /* make sure it is inside the UI viewport */ | ||
412 | if (list_display_title(gui_list, screen) && | 415 | if (list_display_title(gui_list, screen) && |
413 | viewport_point_within_vp(&title_text[screen], x, y) && | 416 | viewport_point_within_vp(&title_text[screen], x, y) && |
414 | button == BUTTON_REL && scroll_mode == SCROLL_NONE) | 417 | button == BUTTON_REL && scroll_mode == SCROLL_NONE) |
@@ -517,7 +520,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) | |||
517 | scroll_mode = SCROLL_NONE; | 520 | scroll_mode = SCROLL_NONE; |
518 | redraw = true; | 521 | redraw = true; |
519 | } | 522 | } |
520 | 523 | ||
521 | /* select current item */ | 524 | /* select current item */ |
522 | gui_synclist_select_item(gui_list, list_start_item+line); | 525 | gui_synclist_select_item(gui_list, list_start_item+line); |
523 | if (last_position == 0) | 526 | if (last_position == 0) |