Fix scrolling left button inadvertently cancels listtree

Depending on the actual keymap, canceling a listtree with the
"scroll left" button may not be intended, especially
if the list is entered from a completely different focus
(think of leaving a plugin with "long left")

Note:
initializing "scrolling_left" with true without anything actually
scrolling sounds odd to me... maybe this variable should be renamed?
"pgleft_allow_cancel" comes to my mind (with opposite boolean states)

Change-Id: I58a747fc90e91ae96e75932febb462f1f1a1b4ca
This commit is contained in:
Sebastian Leonhardt 2015-10-21 00:11:44 +02:00 committed by Gerrit Rockbox
parent ce26212138
commit a8758c953d

View file

@ -625,7 +625,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
{
int action = *actionptr;
#ifdef HAVE_LCD_BITMAP
static bool scrolling_left = false;
static bool pgleft_allow_cancel = false;
#endif
#ifdef HAVE_WHEEL_ACCELERATION
@ -735,24 +735,26 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
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 */
button press. Leave out ACTION_TREE_ROOT_INIT in your keymaps to
disable cancel action by PGLEFT key (e.g. if PGLEFT and CANCEL
are mapped to different keys) */
if (lists->offset_position[0] == 0)
{
scrolling_left = false;
pgleft_allow_cancel = true;
*actionptr = ACTION_STD_CANCEL;
return true;
}
*actionptr = ACTION_TREE_PGLEFT;
case ACTION_TREE_PGLEFT:
if(!scrolling_left && (lists->offset_position[0] == 0))
if(pgleft_allow_cancel && (lists->offset_position[0] == 0))
{
*actionptr = ACTION_STD_CANCEL;
return false;
}
gui_synclist_scroll_left(lists);
gui_synclist_draw(lists);
scrolling_left = true; /* stop ACTION_TREE_PAGE_LEFT
skipping to root */
pgleft_allow_cancel = false; /* stop ACTION_TREE_PAGE_LEFT
skipping to root */
return true;
#endif
/* for pgup / pgdown, we are obliged to have a different behaviour depending