summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/dmenu.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-04-23 01:29:35 +0000
committerjkh <jkh@FreeBSD.org>1996-04-23 01:29:35 +0000
commite665fee23a1e8faaacaceda94ce45295956dee10 (patch)
tree61dd517d68f78c02b32b70a1ec457f1509801e87 /usr.sbin/sysinstall/dmenu.c
parent70a317a618a87b0eac973736356fadfa45b35959 (diff)
downloadFreeBSD-src-e665fee23a1e8faaacaceda94ce45295956dee10.zip
FreeBSD-src-e665fee23a1e8faaacaceda94ce45295956dee10.tar.gz
Bring this into sync.
I still have a _very very annoying_ display bug which occurs when a menu item causes a submenu to be displayed - the screen repaints for the original menu (which is restored upon return from the submenu) are off by about 4 characters. I've tried restoring the screen, the cursor position, you name it - same deal. Grrrr! This commit is my first step in trying to get someone else to help me look into this one since I'm just tearing my hair out at this point!
Diffstat (limited to 'usr.sbin/sysinstall/dmenu.c')
-rw-r--r--usr.sbin/sysinstall/dmenu.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c
index 1a366b0..8081dd7 100644
--- a/usr.sbin/sysinstall/dmenu.c
+++ b/usr.sbin/sysinstall/dmenu.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
- * $Id: dmenu.c,v 1.15 1996/04/07 03:52:23 jkh Exp $
+ * $Id: dmenu.c,v 1.16 1996/04/13 13:31:31 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -45,45 +45,39 @@ int
dmenuDisplayFile(dialogMenuItem *tmp)
{
systemDisplayHelp((char *)tmp->data);
- return DITEM_SUCCESS;
+ return DITEM_SUCCESS | DITEM_RESTORE;
}
int
dmenuSubmenu(dialogMenuItem *tmp)
{
- WINDOW *w;
+ int i;
- w = savescr();
- dialog_clear();
- (void)dmenuOpenSimple((DMenu *)tmp->data);
- restorescr(w);
- return DITEM_SUCCESS;
+ i = dmenuOpenSimple((DMenu *)tmp->data) ? DITEM_SUCCESS : DITEM_FAILURE;
+ return i | DITEM_RESTORE;
}
int
-dmenuSystemCommand(dialogMenuItem *tmp)
+dmenuSystemCommand(dialogMenuItem *self)
{
- WINDOW *w;
-
- w = savescr();
- systemExecute((char *)tmp->data);
- dialog_clear();
- restorescr(w);
+ WINDOW *w = NULL; /* Keep lint happy */
+
+ /* If aux is set, the command is known not to produce any screen-spoiling output */
+ if (!self->aux)
+ w = savescr();
+ systemExecute((char *)self->data);
+ if (!self->aux)
+ restorescr(w);
return DITEM_SUCCESS;
}
int
dmenuSystemCommandBox(dialogMenuItem *tmp)
{
- WINDOW *w;
-
- w = savescr();
use_helpfile(NULL);
use_helpline("Select OK to dismiss this dialog");
dialog_prgbox(tmp->title, (char *)tmp->data, 22, 76, 1, 1);
- dialog_clear();
- restorescr(w);
- return DITEM_SUCCESS;
+ return DITEM_SUCCESS | DITEM_RESTORE;
}
int
@@ -97,7 +91,6 @@ int
dmenuSetVariable(dialogMenuItem *tmp)
{
variable_set((char *)tmp->data);
- msgInfo("Set %s", tmp->data);
return DITEM_SUCCESS;
}
@@ -125,7 +118,6 @@ dmenuOpenSimple(DMenu *menu)
int choice, scroll, curr, max;
choice = scroll = curr = max = 0;
- dialog_clear();
return dmenuOpen(menu, &choice, &scroll, &curr, &max);
}
@@ -195,6 +187,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
use_helpfile(systemHelpFile(menu->helpfile, buf));
/* Pop up that dialog! */
+ dialog_clear();
if (menu->type & DMENU_NORMAL_TYPE)
rval = dialog_menu((u_char *)menu->title, (u_char *)menu->prompt, -1, -1,
menu_height(menu, n), -n, menu->items, NULL, choice, scroll);
@@ -209,11 +202,9 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
else
msgFatal("Menu: `%s' is of an unknown type\n", menu->title);
- /* This seems to be the only technique that works for getting the display to look right */
- dialog_clear();
- if (rval || menu->type & (DMENU_SELECTION_RETURNS | DMENU_RADIO_TYPE | DMENU_CHECKLIST_TYPE))
+ if (rval)
return FALSE;
- else if (cancelled) {
+ else if (cancelled || (menu->type & (DMENU_SELECTION_RETURNS | DMENU_RADIO_TYPE | DMENU_CHECKLIST_TYPE))) {
cancelled = FALSE;
return TRUE;
}
OpenPOWER on IntegriCloud