diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-04-20 21:01:07 +0100 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-04-21 20:37:47 -0400 |
commit | 306caa275452075cf3a0667c7aa06c4ee6781e35 (patch) | |
tree | fea0fea7c9ca474593d7533b0f55ce6ef84da575 | |
parent | fd4a10719d2b0a632c425ca7267d8819f4e2cb36 (diff) | |
download | rockbox-306caa275452075cf3a0667c7aa06c4ee6781e35.tar.gz rockbox-306caa275452075cf3a0667c7aa06c4ee6781e35.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.c | 7 |
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, | |||
434 | /* query audio status to see if it changed */ | 434 | /* query audio status to see if it changed */ |
435 | redraw_lists = query_audio_status(&old_audio_status); | 435 | redraw_lists = query_audio_status(&old_audio_status); |
436 | 436 | ||
437 | #ifdef HAVE_TOUCHSCREEN | ||
438 | /* need to translate touch actions *first* so the menu callback has | ||
439 | * a chance to intercept before it hits the list's do_button. */ | ||
440 | if (action == ACTION_TOUCHSCREEN) | ||
441 | action = gui_synclist_do_touchscreen(&lists); | ||
442 | #endif | ||
443 | |||
437 | if (menu_callback) | 444 | if (menu_callback) |
438 | { | 445 | { |
439 | int new_action = menu_callback(action, menu, &lists); | 446 | int new_action = menu_callback(action, menu, &lists); |