summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-03-07 10:13:07 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-03-07 10:13:07 +0000
commit43b2d091baafa1b1a6c90af6b927a8acc53f8e7b (patch)
tree169aeee96bb09ddef77d30181fc664d7bfc97b01
parent67b3206709171c560705ea4447f21b73524ed21a (diff)
downloadrockbox-43b2d091baafa1b1a6c90af6b927a8acc53f8e7b.tar.gz
rockbox-43b2d091baafa1b1a6c90af6b927a8acc53f8e7b.tar.bz2
rockbox-43b2d091baafa1b1a6c90af6b927a8acc53f8e7b.zip
Fix the various bugs associated with pressing MENU to move in and out of
the Rockbox Menu git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12666 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/menu.c17
-rw-r--r--apps/root_menu.c15
2 files changed, 20 insertions, 12 deletions
diff --git a/apps/menu.c b/apps/menu.c
index c074ec379d..62cce5a721 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -607,7 +607,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
const struct menu_item_ex *menu_stack[MAX_MENUS];
int menu_stack_selected_item[MAX_MENUS];
int stack_top = 0;
- bool in_stringlist;
+ bool in_stringlist, done = false;
menu_callback_type menu_callback = NULL;
if (start_menu == NULL)
menu = &main_menu_;
@@ -630,7 +630,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
/* load the callback, and only reload it if menu changes */
get_menu_callback(menu, &menu_callback);
- while (ret == 0)
+ while (!done)
{
action = get_action(CONTEXT_MAINMENU,HZ);
/* HZ so the status bar redraws corectly */
@@ -660,6 +660,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
else if (action == ACTION_MENU_WPS)
{
ret = GO_TO_PREVIOUS_MUSIC;
+ done = true;
}
else if (action == ACTION_MENU_STOP)
{
@@ -677,6 +678,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
ret = GO_TO_ROOT;
else
ret = GO_TO_PREVIOUS;
+ done = true;
}
else if (action == ACTION_STD_CANCEL)
{
@@ -697,7 +699,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
else if (menu != &root_menu_)
{
ret = GO_TO_PREVIOUS;
- break;
+ done = true;
}
}
else if (action == ACTION_STD_OK)
@@ -766,9 +768,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
}
break;
case MT_RETURN_VALUE:
- if (start_selected)
- *start_selected = selected;
- return temp->value;
+ ret = temp->value;
+ done = true;
+ break;
}
if (type != MT_MENU && menu_callback)
menu_callback(ACTION_EXIT_MENUITEM,temp);
@@ -786,7 +788,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
}
action_signalscreenchange();
if (start_selected)
- *start_selected = selected;
+ *start_selected = get_menu_selection(
+ gui_synclist_get_sel_pos(&lists), menu);
return ret;
}
diff --git a/apps/root_menu.c b/apps/root_menu.c
index abee02dbf7..c234614bc6 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -359,16 +359,21 @@ void root_menu(void)
switch (ret_val)
{
case GO_TO_ROOT:
- selected = get_selection(last_screen);
+ if (last_screen != GO_TO_ROOT)
+ selected = get_selection(last_screen);
ret_val = do_menu(&root_menu_, &selected);
/* As long as MENU_ATTACHED_USB == GO_TO_ROOT this works */
- if (ret_val == MENU_ATTACHED_USB)
+ if (ret_val <= GO_TO_ROOT)
{
- check_boot();
+ if (ret_val == MENU_ATTACHED_USB)
+ check_boot();
+ else if (ret_val == GO_TO_PREVIOUS)
+ {
+ ret_val = last_screen;
+ last_screen = GO_TO_ROOT;
+ }
continue;
}
- else if (ret_val <= GO_TO_ROOT)
- continue;
last_screen = GO_TO_ROOT;
break;