Index: screens.c =================================================================== --- screens.c (revision 20021) +++ screens.c (working copy) @@ -75,10 +75,6 @@ #include "dsp.h" #endif -#ifdef HAVE_LCD_BITMAP -#define SCROLLBAR_WIDTH 6 -#endif - /* only used in set_time screen */ #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) static int clamp_value_wrap(int value, int max, int min) Index: gui/list.h =================================================================== --- gui/list.h (revision 20021) +++ gui/list.h (working copy) @@ -26,7 +26,13 @@ #include "icon.h" #include "screen_access.h" +#ifdef HAVE_TOUCHSCREEN +#define SCROLLBAR_WIDTH 10 +#define ICON_PADDING 2 +#else #define SCROLLBAR_WIDTH 6 +#define ICON_PADDING 1 +#endif enum list_wrap { LIST_WRAP_ON = 0, Index: gui/bitmap/list.c =================================================================== --- gui/bitmap/list.c (revision 20021) +++ gui/bitmap/list.c (working copy) @@ -42,9 +42,6 @@ #include "talk.h" #include "viewport.h" -#define SCROLLBAR_WIDTH 6 -#define ICON_PADDING 1 - /* these are static to make scrolling work */ static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS]; @@ -282,7 +279,6 @@ display->set_viewport(NULL); } - #if defined(HAVE_TOUCHSCREEN) /* 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 @@ -356,27 +352,53 @@ 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 = 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; - - if (gui_list->start_item[screen]+line > gui_list->nb_items) + + /* Behaviour depends whether there are more items then the screen + can show */ + if(gui_list->nb_items > LCD_HEIGHT/line_height + && button & BUTTON_REPEAT) { - /* Pressed below the list*/ - return ACTION_NONE; + int move = last_y - actual_y; + move /= line_height; + + last_y = actual_y; + if(move != 0) + { + scrolling = true; + if(gui_list->selected_item + move > 0 && + gui_list->selected_item + move < gui_list->nb_items) + { + move += gui_list->selected_item; + gui_synclist_select_item(gui_list, move); + return ACTION_REDRAW; + } + } } - last_y = actual_y; - if (line != gui_list->selected_item - - gui_list->start_item[screen] && button ^ BUTTON_REL) + else { - if(button & BUTTON_REPEAT) - scrolling = true; - gui_synclist_select_item(gui_list, gui_list->start_item[screen] - + line); - return ACTION_REDRAW; + last_y = actual_y; + /* Pressed a border */ + if(UNLIKELY(actual_y % line_height == 0)) + return ACTION_NONE; + + if (line != (gui_list->selected_item - gui_list->start_item[screen]) + && button ^ BUTTON_REL) + { + if(button & BUTTON_REPEAT) + scrolling = true; + + gui_synclist_select_item(gui_list, gui_list->start_item[screen] + + line); + + return ACTION_REDRAW; + } } if (button == (BUTTON_REPEAT|BUTTON_REL)) @@ -399,7 +421,8 @@ 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 * selected one or an other one @@ -410,17 +433,9 @@ else return ACTION_NONE; } - /* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */ - else if (y > title_text[screen].y && draw_title(display, gui_list) - && button == BUTTON_REL) - { + /* Everything above the items is cancel */ + else if (y < list_text[screen].y && button == BUTTON_REL) 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; }