aboutsummaryrefslogtreecommitdiffstats
path: root/com32/cmenu
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-07 11:18:13 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-07 11:18:13 -0700
commit93c98eb6780ad1cbbb19d0b70bb07cc9921a6291 (patch)
treede0c33b6f45e8fa97bfe3c402d5529ee3b31899c /com32/cmenu
parent1913abe6f8e12f11a5050d188e631aba7d74a912 (diff)
downloadsyslinux-93c98eb6780ad1cbbb19d0b70bb07cc9921a6291.tar.gz
syslinux-93c98eb6780ad1cbbb19d0b70bb07cc9921a6291.tar.xz
syslinux-93c98eb6780ad1cbbb19d0b70bb07cc9921a6291.zip
cmenu: redraw menu when exiting keys_handler
The keys_handler can change the UI (e.g. the help system draws a black background by default). We need to redraw the background and title on exit. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/cmenu')
-rw-r--r--com32/cmenu/libmenu/menu.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/com32/cmenu/libmenu/menu.c b/com32/cmenu/libmenu/menu.c
index 25adef3c..3ddf0576 100644
--- a/com32/cmenu/libmenu/menu.c
+++ b/com32/cmenu/libmenu/menu.c
@@ -139,6 +139,24 @@ int find_shortcut(pt_menu menu, uchar shortcut, int index)
return index; // Sorry not found
}
+/* Redraw background and title */
+static void reset_ui(void)
+{
+ uchar tpos;
+
+ cls();
+ clearwindow(ms->minrow, ms->mincol, ms->maxrow, ms->maxcol,
+ ms->fillchar, ms->fillattr);
+
+ tpos = (ms->numcols - strlen(ms->title) - 1) >> 1; // center it on line
+ gotoxy(ms->minrow, ms->mincol);
+ cprint(ms->tfillchar, ms->titleattr, ms->numcols);
+ gotoxy(ms->minrow, ms->mincol + tpos);
+ csprint(ms->title, ms->titleattr);
+
+ cursoroff();
+}
+
// print the menu starting from FIRST
// will print a maximum of menu->menuheight items
static void printmenu(pt_menu menu, int curr, uchar top, uchar left, uchar first, bool radio)
@@ -411,6 +429,9 @@ static pt_menuitem getmenuoption(pt_menu menu, uchar top, uchar left, uchar star
} else {
if (ms->keys_handler) // Call extra keys handler
ms->keys_handler(ms, menu->items[curr], asc);
+
+ /* The handler may have changed the UI, reset it on exit */
+ reset_ui();
}
break;
}
@@ -559,7 +580,6 @@ void fix_submenus()
pt_menuitem showmenus(uchar startmenu)
{
pt_menuitem rv;
- uchar tpos;
fix_submenus(); // Fix submenu numbers incase nick names were used
@@ -567,17 +587,7 @@ pt_menuitem showmenus(uchar startmenu)
printf(CSI "?7l");
// Setup screen for menusystem
- cls();
- clearwindow(ms->minrow, ms->mincol, ms->maxrow, ms->maxcol,
- ms->fillchar, ms->fillattr);
-
- tpos = (ms->numcols - strlen(ms->title) - 1) >> 1; // center it on line
- gotoxy(ms->minrow, ms->mincol);
- cprint(ms->tfillchar, ms->titleattr, ms->numcols);
- gotoxy(ms->minrow, ms->mincol + tpos);
- csprint(ms->title, ms->titleattr);
-
- cursoroff(); // Doesn't seem to work?
+ reset_ui();
// Go, main menu cannot be a radio menu
rv = runmenusystem(ms->minrow + MENUROW, ms->mincol + MENUCOL,