diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-10-30 07:07:45 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-10-30 07:07:45 +0000 |
commit | fdd4050bc7bb36deb1fc2b2db441ffae1030cf77 (patch) | |
tree | 1a46923fa2a07c209d71929fe7b0fafb2f21daff | |
parent | 25d4f4bb7a966407199c4602c3041b71994400c4 (diff) |
fix some problems with the menu code:
- MENU_FUNC_CHECK_RETVAL has been loosened to return if the function returns non-zero (and passes that return value on as the return value for do_menu(). This is fine for now because only 2 places uses this flag and both return 1.
- when the option screen or a function is called from a menu which doesn't use the full screen viewport the wrong viewport was used (option screen crashed, and returning from the funciton ignored the origional viewport.) This is now changed so (for now) the option screen always gets the full screen viewport and returning from functions shows the menu correctly.
Some time in the future menu items which are functions should be changed to accept a viewport (if they end up drawing).
When that happens both option screen and the called function should use the menu's parent viewport
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18933 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/menu.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/menu.c b/apps/menu.c index c3bc00b010..d01cbc64be 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -397,6 +397,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, menu = &main_menu_; else menu = start_menu; + init_default_menu_viewports(menu_vp, hide_bars); + if (parent) { vps = parent; @@ -405,7 +407,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, else { vps = menu_vp; - init_default_menu_viewports(vps, hide_bars); } FOR_NB_SCREENS(i) { @@ -438,7 +439,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, list_do_action_timeout(&lists, HZ)); /* HZ so the status bar redraws corectly */ - if (action != ACTION_NONE && menu_callback) + if (menu_callback) { int old_action = action; action = menu_callback(action, menu); @@ -584,12 +585,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, return_value = temp->function->function(); if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU)) { - init_default_menu_viewports(menu_vp, hide_bars); init_menu_lists(menu, &lists, selected, true, vps); } if (temp->flags&MENU_FUNC_CHECK_RETVAL) { - if (return_value == 1) + if (return_value != 0) { done = true; ret = return_value; @@ -602,7 +602,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, { if (do_setting_from_menu(temp, menu_vp)) { - init_default_menu_viewports(menu_vp, hide_bars); init_menu_lists(menu, &lists, selected, true,vps); redraw_lists = false; /* above does the redraw */ } @@ -661,6 +660,8 @@ 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); } |