summaryrefslogtreecommitdiffstats
path: root/apps/menu.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-07-19 13:42:04 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2020-07-19 22:10:26 +0000
commitc39f95465b9844f70f375f1690e0bf75c7ee7cc1 (patch)
tree2fda6bd805a74f41dd4303c7699eabb9e1aa4a1c /apps/menu.c
parent4663d94b4e4edec609b6a24581ee345f2a1bedaa (diff)
downloadrockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.tar.gz
rockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.tar.bz2
rockbox-c39f95465b9844f70f375f1690e0bf75c7ee7cc1.zip
do_menu pass internal synclist reference to callback
keep running into the rigid nature of do_menu it isn't too bad when you don't need voice but once you do the fun awaits do_menu likes to talk on menu enter which is in a loop when you use do_menu I would like to move the processing to the callback TOO BAD you only get an action and the menu_item_ex struct you sent it when calling the function Change-Id: Iaefd0cc133435d675b7dd27a558c504d6ccb327a
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/menu.c b/apps/menu.c
index 929a14e9f0..5a388522fa 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -192,7 +192,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
if (menu_callback)
{
if (menu_callback(ACTION_REQUEST_MENUITEM,
- type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i])
+ type==MT_RETURN_ID ? (void*)(intptr_t)i: menu->submenus[i], lists)
!= ACTION_EXIT_MENUITEM)
{
current_subitems[current_subitems_count] = i;
@@ -246,7 +246,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
get_menu_callback(menu,&menu_callback);
if (callback && menu_callback)
- menu_callback(ACTION_ENTER_MENUITEM,menu);
+ menu_callback(ACTION_ENTER_MENUITEM, menu, lists);
}
static int talk_menu_item(int selected_item, void *data)
@@ -430,7 +430,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (menu_callback)
{
int old_action = action;
- action = menu_callback(action, menu);
+ action = menu_callback(action, menu, &lists);
if (action == ACTION_EXIT_AFTER_THIS_MENUITEM)
{
action = old_action;
@@ -560,7 +560,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
/* might be leaving list, so stop scrolling */
gui_synclist_scroll_stop(&lists);
if (menu_callback)
- menu_callback(ACTION_EXIT_MENUITEM, menu);
+ menu_callback(ACTION_EXIT_MENUITEM, menu, &lists);
if (menu->flags&MENU_EXITAFTERTHISMENU)
done = true;
@@ -612,7 +612,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
get_menu_callback(temp, &menu_callback);
if (menu_callback)
{
- action = menu_callback(ACTION_ENTER_MENUITEM,temp);
+ action = menu_callback(ACTION_ENTER_MENUITEM, temp, &lists);
if (action == ACTION_EXIT_MENUITEM)
break;
}
@@ -688,7 +688,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (type != MT_MENU)
{
if (menu_callback)
- menu_callback(ACTION_EXIT_MENUITEM,temp);
+ menu_callback(ACTION_EXIT_MENUITEM, temp, &lists);
}
if (current_submenus_menu != menu)
init_menu_lists(menu,&lists,selected,true,vps);
@@ -730,9 +730,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (redraw_lists && !done)
{
if (menu_callback)
- menu_callback(ACTION_REDRAW, menu);
- gui_synclist_draw(&lists);
- gui_synclist_speak_item(&lists);
+ if (menu_callback(ACTION_REDRAW, menu, &lists) == ACTION_REDRAW)
+ {
+ gui_synclist_draw(&lists);
+ gui_synclist_speak_item(&lists);
+ }
}
}