summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-10-30 07:07:45 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-10-30 07:07:45 +0000
commitfdd4050bc7bb36deb1fc2b2db441ffae1030cf77 (patch)
tree1a46923fa2a07c209d71929fe7b0fafb2f21daff
parent25d4f4bb7a966407199c4602c3041b71994400c4 (diff)
downloadrockbox-fdd4050bc7bb36deb1fc2b2db441ffae1030cf77.tar.gz
rockbox-fdd4050bc7bb36deb1fc2b2db441ffae1030cf77.zip
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.c11
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,
397 menu = &main_menu_; 397 menu = &main_menu_;
398 else menu = start_menu; 398 else menu = start_menu;
399 399
400 init_default_menu_viewports(menu_vp, hide_bars);
401
400 if (parent) 402 if (parent)
401 { 403 {
402 vps = parent; 404 vps = parent;
@@ -405,7 +407,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
405 else 407 else
406 { 408 {
407 vps = menu_vp; 409 vps = menu_vp;
408 init_default_menu_viewports(vps, hide_bars);
409 } 410 }
410 FOR_NB_SCREENS(i) 411 FOR_NB_SCREENS(i)
411 { 412 {
@@ -438,7 +439,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
438 list_do_action_timeout(&lists, HZ)); 439 list_do_action_timeout(&lists, HZ));
439 /* HZ so the status bar redraws corectly */ 440 /* HZ so the status bar redraws corectly */
440 441
441 if (action != ACTION_NONE && menu_callback) 442 if (menu_callback)
442 { 443 {
443 int old_action = action; 444 int old_action = action;
444 action = menu_callback(action, menu); 445 action = menu_callback(action, menu);
@@ -584,12 +585,11 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
584 return_value = temp->function->function(); 585 return_value = temp->function->function();
585 if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU)) 586 if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU))
586 { 587 {
587 init_default_menu_viewports(menu_vp, hide_bars);
588 init_menu_lists(menu, &lists, selected, true, vps); 588 init_menu_lists(menu, &lists, selected, true, vps);
589 } 589 }
590 if (temp->flags&MENU_FUNC_CHECK_RETVAL) 590 if (temp->flags&MENU_FUNC_CHECK_RETVAL)
591 { 591 {
592 if (return_value == 1) 592 if (return_value != 0)
593 { 593 {
594 done = true; 594 done = true;
595 ret = return_value; 595 ret = return_value;
@@ -602,7 +602,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
602 { 602 {
603 if (do_setting_from_menu(temp, menu_vp)) 603 if (do_setting_from_menu(temp, menu_vp))
604 { 604 {
605 init_default_menu_viewports(menu_vp, hide_bars);
606 init_menu_lists(menu, &lists, selected, true,vps); 605 init_menu_lists(menu, &lists, selected, true,vps);
607 redraw_lists = false; /* above does the redraw */ 606 redraw_lists = false; /* above does the redraw */
608 } 607 }
@@ -661,6 +660,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
661 660
662 if (redraw_lists && !done) 661 if (redraw_lists && !done)
663 { 662 {
663 if (menu_callback)
664 menu_callback(ACTION_REDRAW, menu);
664 gui_synclist_draw(&lists); 665 gui_synclist_draw(&lists);
665 gui_synclist_speak_item(&lists); 666 gui_synclist_speak_item(&lists);
666 } 667 }