From a8758c953d50fb020b245d5739c41de113638b49 Mon Sep 17 00:00:00 2001 From: Sebastian Leonhardt Date: Wed, 21 Oct 2015 00:11:44 +0200 Subject: 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 --- apps/gui/list.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/gui/list.c b/apps/gui/list.c index 8663abe8a0..eb5f298316 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -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 -- cgit v1.2.3