From 66868cb27d32f490ae3682562ddc72a09e4c8aa1 Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Meyer Date: Mon, 7 Sep 2009 15:03:28 -0700 Subject: [PATCH] cmenu: redraw the current menu after exiting the keys_handler After exiting the keys_handler, reset_ui() is not enough since it only resets the status line and title. The current menu needs to be redrawn. Note: only a submenu will be redrawn, not its parents. This means that not all the UI will be displayed after exiting the handler if invoked from whithin a submenu. We have already this problem nowadays when exiting a submenu of a submenu. The root parent is not redrawn, leading to some ugly states (the background color overrides part of the root menu). This will be fixed when we implement a real hierarchy (each submenu having access to its parents). Signed-off-by: Pierre-Alexandre Meyer --- com32/cmenu/libmenu/menu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/com32/cmenu/libmenu/menu.c b/com32/cmenu/libmenu/menu.c index dea1975..5a33a52 100644 --- a/com32/cmenu/libmenu/menu.c +++ b/com32/cmenu/libmenu/menu.c @@ -487,6 +487,12 @@ static pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar star /* The handler may have changed the UI, reset it on exit */ reset_ui(); + // Cleanup menu using old number of items + cleanupmenu(menu, top, left, numitems); + // Recalculate the number of items + numitems = calc_visible(menu, 0); + // Reprint the menu + printmenu(menu, curr, top, left, first, radio); } break; } -- 2.7.4