From 12f5a1e60e0806527f49366effeed19bf67d8a1b Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Fri, 5 Nov 2010 19:23:34 +0000 Subject: Make the context menu pop up instantly after the long press timeout when holding a list item instead of just after the thumb/styles left the screen. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28499 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/bitmap/list.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index d78f005e6a..26e15e7978 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -630,8 +630,11 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) && !is_kinetic_over()); int icon_width = 0; int line, list_width = list_text_vp->width; + static bool wait_for_release = false; released = (button&BUTTON_REL) != 0; + if (released) + wait_for_release = false; if (button == ACTION_NONE || button == ACTION_UNKNOWN) { @@ -738,21 +741,23 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list) return ACTION_NONE; } + if (button & BUTTON_REPEAT && scroll_mode == SCROLL_NONE + && !wait_for_release) + { + /* held a single line for a while, bring up the context menu */ + gui_synclist_select_item(gui_list, list_start_item + line); + /* don't sent context repeatedly */ + wait_for_release = true; + return ACTION_STD_CONTEXT; + } if (released && !cancelled_kinetic) { /* Pen was released anywhere on the screen */ last_position = 0; if (scroll_mode == SCROLL_NONE) { + /* select current line */ gui_synclist_select_item(gui_list, list_start_item + line); - /* If BUTTON_REPEAT is set, then the pen was hold on - * the same line for some time - * -> context menu - * otherwise, - * -> select - **/ - if (button & BUTTON_REPEAT) - return ACTION_STD_CONTEXT; return ACTION_STD_OK; } else -- cgit v1.2.3