diff options
-rw-r--r-- | apps/gui/list.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 6fdc7a10a5..fbb7508779 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -803,12 +803,13 @@ void gui_synclist_speak_item(struct gui_synclist * lists) | |||
803 | extern intptr_t get_action_data(void); | 803 | extern intptr_t get_action_data(void); |
804 | 804 | ||
805 | #if defined(HAVE_TOUCHPAD) | 805 | #if defined(HAVE_TOUCHPAD) |
806 | unsigned gui_synclist_do_touchpad(struct gui_synclist * lists) | 806 | /* this needs to be fixed if we ever get more than 1 touchscreen on a target */ |
807 | unsigned gui_synclist_do_touchpad(struct gui_synclist * gui_list) | ||
807 | { | 808 | { |
808 | struct gui_list *gui_list = &(lists->gui_list[SCREEN_MAIN]); | ||
809 | short x,y; | 809 | short x,y; |
810 | unsigned button = action_get_touchpad_press(&x, &y); | 810 | unsigned button = action_get_touchpad_press(&x, &y); |
811 | int line; | 811 | int line; |
812 | struct screen *display = &screens[SCREEN_MAIN]; | ||
812 | if (button == BUTTON_NONE) | 813 | if (button == BUTTON_NONE) |
813 | return ACTION_NONE; | 814 | return ACTION_NONE; |
814 | if (x<SCROLLBAR_WIDTH) | 815 | if (x<SCROLLBAR_WIDTH) |
@@ -828,20 +829,19 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * lists) | |||
828 | { | 829 | { |
829 | int new_selection, nb_lines; | 830 | int new_selection, nb_lines; |
830 | int height, size; | 831 | int height, size; |
831 | nb_lines = gui_list->display->nb_lines - SHOW_LIST_TITLE; | 832 | nb_lines = display->nb_lines - SHOW_LIST_TITLE; |
832 | if (nb_lines < gui_list->nb_items) | 833 | if (nb_lines < gui_list->nb_items) |
833 | { | 834 | { |
834 | height = nb_lines * gui_list->display->char_height; | 835 | height = nb_lines * display->char_height; |
835 | size = height*nb_lines / gui_list->nb_items; | 836 | size = height*nb_lines / gui_list->nb_items; |
836 | new_selection = (y*(gui_list->nb_items-nb_lines))/(height-size); | 837 | new_selection = (y*(gui_list->nb_items-nb_lines))/(height-size); |
837 | gui_synclist_select_item(lists, new_selection); | 838 | gui_synclist_select_item(gui_list, new_selection); |
838 | nb_lines /= 2; | 839 | nb_lines /= 2; |
839 | if (new_selection - gui_list->start_item > nb_lines) | 840 | if (new_selection - gui_list->start_item[SCREEN_MAIN] > nb_lines) |
840 | { | 841 | { |
841 | new_selection = gui_list->start_item+nb_lines; | 842 | new_selection = gui_list->start_item[SCREEN_MAIN]+nb_lines; |
842 | } | 843 | } |
843 | FOR_NB_SCREENS(line) | 844 | gui_list->start_item[SCREEN_MAIN] = new_selection; |
844 | lists->gui_list[line].selected_item = new_selection; | ||
845 | return ACTION_REDRAW; | 845 | return ACTION_REDRAW; |
846 | } | 846 | } |
847 | } | 847 | } |
@@ -853,10 +853,10 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * lists) | |||
853 | if (global_settings.statusbar) | 853 | if (global_settings.statusbar) |
854 | y -= STATUSBAR_HEIGHT; | 854 | y -= STATUSBAR_HEIGHT; |
855 | if (SHOW_LIST_TITLE) | 855 | if (SHOW_LIST_TITLE) |
856 | y -= gui_list->display->char_height; | 856 | y -= display->char_height; |
857 | line = y / gui_list->display->char_height; | 857 | line = y / display->char_height; |
858 | if (line != gui_list->selected_item - gui_list->start_item) | 858 | if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN]) |
859 | gui_synclist_select_item(lists, gui_list->start_item+line); | 859 | gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line); |
860 | return ACTION_REDRAW; | 860 | return ACTION_REDRAW; |
861 | } | 861 | } |
862 | /* title or statusbar is cancel */ | 862 | /* title or statusbar is cancel */ |
@@ -869,18 +869,18 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * lists) | |||
869 | /* title goes up one level */ | 869 | /* title goes up one level */ |
870 | if (SHOW_LIST_TITLE) | 870 | if (SHOW_LIST_TITLE) |
871 | { | 871 | { |
872 | if (y < gui_list->display->char_height) | 872 | if (y < display->char_height) |
873 | return ACTION_STD_CANCEL; | 873 | return ACTION_STD_CANCEL; |
874 | y -= gui_list->display->char_height; | 874 | y -= display->char_height; |
875 | } | 875 | } |
876 | /* pressing an item will select it. | 876 | /* pressing an item will select it. |
877 | pressing the selected item will "enter" it */ | 877 | pressing the selected item will "enter" it */ |
878 | line = y / gui_list->display->char_height; | 878 | line = y / display->char_height; |
879 | if (line != gui_list->selected_item - gui_list->start_item) | 879 | if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN]) |
880 | { | 880 | { |
881 | if (gui_list->start_item+line > gui_list->nb_items) | 881 | if (gui_list->start_item[SCREEN_MAIN]+line > gui_list->nb_items) |
882 | return ACTION_NONE; | 882 | return ACTION_NONE; |
883 | gui_synclist_select_item(lists, gui_list->start_item+line); | 883 | gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line); |
884 | } | 884 | } |
885 | 885 | ||
886 | if (button == BUTTON_REPEAT) | 886 | if (button == BUTTON_REPEAT) |