summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-04-20 21:01:07 +0100
committerSolomon Peachy <pizza@shaftnet.org>2024-04-21 20:37:47 -0400
commit306caa275452075cf3a0667c7aa06c4ee6781e35 (patch)
treefea0fea7c9ca474593d7533b0f55ce6ef84da575
parentfd4a10719d2b0a632c425ca7267d8819f4e2cb36 (diff)
downloadrockbox-306caa2754.tar.gz
rockbox-306caa2754.zip
touchscreen: Fix menu callbacks in touchscreen pointing mode
Touchscreen events get translated into standard actions only after the call to gui_synclist_do_button(). The menu callback doesn't get a chance to see the real action if it is called before do_button. Moving the do_button call up could potentially break callbacks that want to intercept actions before they hit the list code. Therefore we need to manually handle touch events first, and pass the action to do_button afterward. Fixes a bug where exiting a plugin in touchscreen point mode always goes to the games list because the callback wasn't invoked properly. Change-Id: I3b74a16d68a111935fba2157c15fa188f15446e9
-rw-r--r--apps/menu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/menu.c b/apps/menu.c
index df2284be12..bd9ff90cbe 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -434,6 +434,13 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
/* query audio status to see if it changed */
redraw_lists = query_audio_status(&old_audio_status);
+#ifdef HAVE_TOUCHSCREEN
+ /* need to translate touch actions *first* so the menu callback has
+ * a chance to intercept before it hits the list's do_button. */
+ if (action == ACTION_TOUCHSCREEN)
+ action = gui_synclist_do_touchscreen(&lists);
+#endif
+
if (menu_callback)
{
int new_action = menu_callback(action, menu, &lists);