summaryrefslogtreecommitdiffstats
path: root/contrib/dialog/pause.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2012-12-30 04:22:34 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2012-12-30 04:22:34 +0000
commit52bf5abd924bc78494905f16ffbd4bd67062240c (patch)
tree6d48accafd38ffd900622df8c9eab499d302c36f /contrib/dialog/pause.c
parent7e3a527820c0248a0703bbf8809aabef78a41db6 (diff)
downloadFreeBSD-src-52bf5abd924bc78494905f16ffbd4bd67062240c.zip
FreeBSD-src-52bf5abd924bc78494905f16ffbd4bd67062240c.tar.gz
Revert r241818 that updated dialog to 20120706. This turns out to horribly
break mixed form dialogs in conjunction with the FreeBSD termcap, making the bsdinstall partition editor Add dialog, among other things, completely nonfunctional. This restores dialog 20110707.
Diffstat (limited to 'contrib/dialog/pause.c')
-rw-r--r--contrib/dialog/pause.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/contrib/dialog/pause.c b/contrib/dialog/pause.c
index acca9b7..c104a70 100644
--- a/contrib/dialog/pause.c
+++ b/contrib/dialog/pause.c
@@ -1,9 +1,9 @@
/*
- * $Id: pause.c,v 1.36 2012/07/03 00:01:59 tom Exp $
+ * $Id: pause.c,v 1.29 2011/06/29 09:48:53 tom Exp $
*
* pause.c -- implements the pause dialog
*
- * Copyright 2004-2011,2012 Thomas E. Dickey
+ * Copyright 2004-2010,2011 Thomas E. Dickey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License, version 2.1
@@ -55,7 +55,13 @@ dialog_pause(const char *title,
static DLG_KEYS_BINDING binding[] = {
HELPKEY_BINDINGS,
ENTERKEY_BINDINGS,
- TRAVERSE_BINDINGS,
+ DLG_KEYS_DATA( DLGK_ENTER, ' ' ),
+ DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ),
+ DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ),
+ DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ),
+ DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP ),
+ DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ),
+ DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ),
END_KEYS_BINDING
};
/* *INDENT-ON* */
@@ -66,24 +72,21 @@ dialog_pause(const char *title,
#endif
int i, x, y, step;
- int button = dlg_default_button();
+ int button = 0;
int seconds_orig;
WINDOW *dialog;
const char **buttons = dlg_ok_labels();
bool have_buttons = (dlg_button_count(buttons) != 0);
- bool first;
int key = 0, fkey;
int result = DLG_EXIT_UNKNOWN;
int button_high = (have_buttons ? BTN_HIGH : MARGIN);
int gauge_y;
char *prompt = dlg_strclone(cprompt);
- int save_timeout = dialog_vars.timeout_secs;
curs_set(0);
dlg_tab_correct_str(prompt);
- dialog_vars.timeout_secs = 0;
seconds_orig = (seconds > 0) ? seconds : 1;
#ifdef KEY_RESIZE
@@ -117,23 +120,21 @@ dialog_pause(const char *title,
dlg_mouse_setbase(x, y);
nodelay(dialog, TRUE);
- first = TRUE;
do {
(void) werase(dialog);
- dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr);
+ dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
dlg_draw_title(dialog, title);
dlg_draw_helpline(dialog, FALSE);
- (void) wattrset(dialog, dialog_attr);
+ wattrset(dialog, dialog_attr);
dlg_print_autowrap(dialog, prompt, height, width);
- dlg_draw_box2(dialog,
- gauge_y, 2 + MARGIN,
- 2 + MARGIN, width - 2 * (2 + MARGIN),
- dialog_attr,
- border_attr,
- border2_attr);
+ dlg_draw_box(dialog,
+ gauge_y, 2 + MARGIN,
+ 2 + MARGIN, width - 2 * (2 + MARGIN),
+ dialog_attr,
+ border_attr);
/*
* Clear the area for the progress bar by filling it with spaces
@@ -141,7 +142,7 @@ dialog_pause(const char *title,
* attribute.
*/
(void) wmove(dialog, gauge_y + MARGIN, 4);
- (void) wattrset(dialog, title_attr);
+ wattrset(dialog, title_attr);
for (i = 0; i < (width - 2 * (3 + MARGIN)); i++)
(void) waddch(dialog, ' ');
@@ -158,7 +159,7 @@ dialog_pause(const char *title,
if ((title_attr & A_REVERSE) != 0) {
wattroff(dialog, A_REVERSE);
} else {
- (void) wattrset(dialog, A_REVERSE);
+ wattrset(dialog, A_REVERSE);
}
(void) wmove(dialog, gauge_y + MARGIN, 4);
for (i = 0; i < x; i++) {
@@ -171,14 +172,10 @@ dialog_pause(const char *title,
mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n');
if (have_buttons) {
- dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr);
+ dlg_draw_bottom_box(dialog);
dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width);
}
- if (first) {
- (void) wrefresh(dialog);
- dlg_trace_win(dialog);
- first = FALSE;
- }
+ (void) wrefresh(dialog);
for (step = 0;
(result == DLG_EXIT_UNKNOWN) && (step < 1000);
@@ -222,25 +219,24 @@ dialog_pause(const char *title,
case DLGK_ENTER:
result = dlg_enter_buttoncode(button);
break;
+ case DLGK_MOUSE(0):
+ result = DLG_EXIT_OK;
+ break;
+ case DLGK_MOUSE(1):
+ result = DLG_EXIT_CANCEL;
+ break;
case ERR:
break;
default:
- if (is_DLGK_MOUSE(key)) {
- result = dlg_ok_buttoncode(key - M_EVENT);
- if (result < 0)
- result = DLG_EXIT_OK;
- }
break;
}
}
} while ((result == DLG_EXIT_UNKNOWN) && (seconds-- > 0));
+ nodelay(dialog, FALSE);
curs_set(1);
dlg_mouse_free_regions();
dlg_del_window(dialog);
free(prompt);
-
- dialog_vars.timeout_secs = save_timeout;
-
return ((result == DLG_EXIT_UNKNOWN) ? DLG_EXIT_OK : result);
}
OpenPOWER on IntegriCloud