summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-12-17 04:23:34 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-12-17 04:23:34 +0000
commit213d9a2ca1cdd93511e84ca2a857bc82e8b0e661 (patch)
tree9d7a0d5455df5351e26d069a5d15c69f23120351 /apps
parentf5ec3e49e0687eda7b9059942c23321f9878becf (diff)
downloadrockbox-213d9a2ca1cdd93511e84ca2a857bc82e8b0e661.zip
rockbox-213d9a2ca1cdd93511e84ca2a857bc82e8b0e661.tar.gz
rockbox-213d9a2ca1cdd93511e84ca2a857bc82e8b0e661.tar.bz2
rockbox-213d9a2ca1cdd93511e84ca2a857bc82e8b0e661.tar.xz
fix touchpad list code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15948 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/list.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 6fdc7a1..fbb7508 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -803,12 +803,13 @@ void gui_synclist_speak_item(struct gui_synclist * lists)
extern intptr_t get_action_data(void);
#if defined(HAVE_TOUCHPAD)
-unsigned gui_synclist_do_touchpad(struct gui_synclist * lists)
+/* this needs to be fixed if we ever get more than 1 touchscreen on a target */
+unsigned gui_synclist_do_touchpad(struct gui_synclist * gui_list)
{
- struct gui_list *gui_list = &(lists->gui_list[SCREEN_MAIN]);
short x,y;
unsigned button = action_get_touchpad_press(&x, &y);
int line;
+ struct screen *display = &screens[SCREEN_MAIN];
if (button == BUTTON_NONE)
return ACTION_NONE;
if (x<SCROLLBAR_WIDTH)
@@ -828,20 +829,19 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * lists)
{
int new_selection, nb_lines;
int height, size;
- nb_lines = gui_list->display->nb_lines - SHOW_LIST_TITLE;
+ nb_lines = display->nb_lines - SHOW_LIST_TITLE;
if (nb_lines < gui_list->nb_items)
{
- height = nb_lines * gui_list->display->char_height;
+ height = nb_lines * display->char_height;
size = height*nb_lines / gui_list->nb_items;
new_selection = (y*(gui_list->nb_items-nb_lines))/(height-size);
- gui_synclist_select_item(lists, new_selection);
+ gui_synclist_select_item(gui_list, new_selection);
nb_lines /= 2;
- if (new_selection - gui_list->start_item > nb_lines)
+ if (new_selection - gui_list->start_item[SCREEN_MAIN] > nb_lines)
{
- new_selection = gui_list->start_item+nb_lines;
+ new_selection = gui_list->start_item[SCREEN_MAIN]+nb_lines;
}
- FOR_NB_SCREENS(line)
- lists->gui_list[line].selected_item = new_selection;
+ gui_list->start_item[SCREEN_MAIN] = new_selection;
return ACTION_REDRAW;
}
}
@@ -853,10 +853,10 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * lists)
if (global_settings.statusbar)
y -= STATUSBAR_HEIGHT;
if (SHOW_LIST_TITLE)
- y -= gui_list->display->char_height;
- line = y / gui_list->display->char_height;
- if (line != gui_list->selected_item - gui_list->start_item)
- gui_synclist_select_item(lists, gui_list->start_item+line);
+ y -= display->char_height;
+ line = y / display->char_height;
+ if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN])
+ gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line);
return ACTION_REDRAW;
}
/* title or statusbar is cancel */
@@ -869,18 +869,18 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * lists)
/* title goes up one level */
if (SHOW_LIST_TITLE)
{
- if (y < gui_list->display->char_height)
+ if (y < display->char_height)
return ACTION_STD_CANCEL;
- y -= gui_list->display->char_height;
+ y -= display->char_height;
}
/* pressing an item will select it.
pressing the selected item will "enter" it */
- line = y / gui_list->display->char_height;
- if (line != gui_list->selected_item - gui_list->start_item)
+ line = y / display->char_height;
+ if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN])
{
- if (gui_list->start_item+line > gui_list->nb_items)
+ if (gui_list->start_item[SCREEN_MAIN]+line > gui_list->nb_items)
return ACTION_NONE;
- gui_synclist_select_item(lists, gui_list->start_item+line);
+ gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line);
}
if (button == BUTTON_REPEAT)