diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-04-10 10:08:30 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-04-10 10:09:39 +0200 |
commit | d3ead233a820cb893dc39b14eb8679a9a51e3b00 (patch) | |
tree | cebb20de48661cab88337dc64de922e7a7f64ac9 | |
parent | b7bc2404893b415d0f6cc848715b981f40474782 (diff) |
touchscreen: fix some issues/crashes with clicking the list title.
Change-Id: I31adb012ac39f9b27f6b91f5077ed4195ba1dc02
-rw-r--r-- | apps/gui/bitmap/list.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 3d6028ae23..e1acecd218 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -716,10 +716,6 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list) action = action_get_touchscreen_press(&x, &y); adj_y = y - parent->y; - /* selection needs to be corrected if items are only partially visible */ - line = (adj_y - y_offset) / line_height; - if (list_display_title(list, screen)) - line -= 1; /* adjust for the list title */ /* some defaults before running the state machine */ recurse = false; @@ -729,8 +725,6 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list) { case SCROLL_NONE: { - list->selected_item = list_start_item+line; - gui_synclist_speak_item(list); if (!last_y) { /* first run. register adj_y and re-run (will then take the else case) */ last_y = adj_y; @@ -739,6 +733,16 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list) else { int click_loc = get_click_location(list, x, y); + line = 0; /* silence gcc 'used uninitialized' warning */ + if (click_loc & LIST) + { + /* selection needs to be corrected if items are only partially visible */ + line = (adj_y - y_offset) / line_height; + if (list_display_title(list, screen)) + line -= 1; /* adjust for the list title */ + list->selected_item = list_start_item+line; + gui_synclist_speak_item(list); + } if (action == BUTTON_TOUCHSCREEN) { /* if not scrolling, the user is trying to select */ @@ -748,7 +752,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list) else if (click_loc & SCROLLBAR) scroll_mode = SCROLL_BAR; - hide_selection = click_loc & SCROLLBAR; + /* only show selection bar if clicking the list */ + hide_selection = click_loc & (SCROLLBAR|TITLE); } else if (action == BUTTON_REPEAT) { |