From 1ab1f02dfecc8f0b35cf5668398ea327b25828b7 Mon Sep 17 00:00:00 2001 From: Martin Scarratt Date: Mon, 25 Sep 2006 10:56:38 +0000 Subject: fix the bug where when scrolling text left in the filebrowser you could suddenly find yourself in the root directory. A long press on the left scrolling button will still take you to the root quickly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11042 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'apps/gui/list.c') diff --git a/apps/gui/list.c b/apps/gui/list.c index 164bfc8773..7ca5e91b99 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -722,6 +722,8 @@ void gui_synclist_scroll_left(struct gui_synclist * lists) unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) { + static bool scrolling_left = false; + gui_synclist_limit_scroll(lists, true); switch(button) { @@ -744,15 +746,26 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) return ACTION_STD_NEXT; #ifdef HAVE_LCD_BITMAP + case ACTION_TREE_ROOT_INIT: + /* After this button press ACTION_TREE_PGLEFT is allowed to skip to root. + ACTION_TREE_ROOT_INIT must be defined in the keymaps as a repeated + button press (the same as the repeated ACTION_TREE_PGLEFT) with the + pre condition being the non-repeated button press */ + if (lists->gui_list[0].offset_position == 0) + { + scrolling_left = false; + return ACTION_STD_CANCEL; + } case ACTION_TREE_PGRIGHT: gui_synclist_scroll_right(lists); gui_synclist_draw(lists); return ACTION_TREE_PGRIGHT; case ACTION_TREE_PGLEFT: - if (lists->gui_list[0].offset_position == 0) + if(!scrolling_left && (lists->gui_list[0].offset_position == 0)) return ACTION_STD_CANCEL; gui_synclist_scroll_left(lists); gui_synclist_draw(lists); + scrolling_left = true; /* stop ACTION_TREE_PAGE_LEFT skipping to root */ return ACTION_TREE_PGLEFT; #endif -- cgit v1.2.3