some Windows curses adjustments dialog on startup

This commit is contained in:
nhmall
2026-05-22 12:21:42 -04:00
parent 3f837939ba
commit 4c7f2dfaac
3 changed files with 32 additions and 12 deletions
+9
View File
@@ -303,7 +303,9 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
#ifdef WINCHAIN
commit_windowchain();
#endif
init_nhwindows(&argc, argv);
#ifdef TTY_GRAPHICS
if WINDOWPORT(tty) {
int i;
@@ -1265,7 +1267,11 @@ other_self_recover_prompt(void)
int c, ci, ct, pl, retval = 0;
boolean ismswin = WINDOWPORT(mswin),
iscurses = WINDOWPORT(curses);
int save_popupdialog = iflags.wc_popup_dialog;
if (WINDOWPORT(curses)) {
iflags.wc_popup_dialog = TRUE;
}
pl = 1;
c = 'n';
ct = 0;
@@ -1316,6 +1322,9 @@ other_self_recover_prompt(void)
else
retval = 1; /* yes, do recover the old game */
}
if (WINDOWPORT(curses)) {
iflags.wc_popup_dialog = save_popupdialog;
}
return retval;
}
+22 -11
View File
@@ -205,10 +205,8 @@ curses_line_input_dialog(
/* Get a single character response from the player, such as a y/n prompt */
int
curses_character_input_dialog(
const char *prompt,
const char *choices,
char def)
curses_character_input_dialog(const char *prompt, const char *choices,
char def)
{
WINDOW *askwin = NULL;
#ifdef PDCURSES
@@ -222,12 +220,15 @@ curses_character_input_dialog(
int prompt_height = 1;
boolean any_choice = FALSE;
boolean accept_count = FALSE;
#ifdef PDCURSES
int x, y;
#endif
/* if messages were being suppressed for the remainder of the turn,
re-activate them now that input is being requested */
curses_got_input();
if (svm.moves > 0) {
if (svm.moves > 0 || !program_state.beyond_savefile_load) {
curses_get_window_size(MAP_WIN, &map_height, &map_width);
} else {
map_height = term_rows;
@@ -260,10 +261,10 @@ curses_character_input_dialog(
choicestr[count + 5] = def;
choicestr[count + 6] = ')';
choicestr[count + 7] = '\0';
} else { /* No usable default choice */
} else { /* No usable default choice */
choicestr[count + 3] = '\0';
def = '\0'; /* Mark as no default */
def = '\0'; /* Mark as no default */
}
strcpy(askstr, prompt);
strcat(askstr, choicestr);
@@ -281,7 +282,8 @@ curses_character_input_dialog(
}
if (iflags.wc_popup_dialog /*|| curses_stupid_hack*/) {
askwin = curses_create_window(TEXT_WIN, prompt_width, prompt_height, UP);
askwin =
curses_create_window(TEXT_WIN, prompt_width, prompt_height, UP);
activemenu = askwin;
for (count = 0; count < prompt_height; count++) {
@@ -291,6 +293,11 @@ curses_character_input_dialog(
}
curses_set_wid_colors(TEXT_WIN, askwin);
#ifdef PDCURSES
getyx(askwin, y, x);
wmove(askwin, y, x);
curs_set(1);
#endif
wrefresh(askwin);
} else {
/* TODO: add SUPPRESS_HISTORY flag, then after getting a response,
@@ -299,11 +306,15 @@ curses_character_input_dialog(
}
/*curses_stupid_hack = 0; */
#ifndef PDCURSES
curs_set(1);
#endif
while (1) {
#ifdef PDCURSES
answer = wgetch(message_window);
if (WIN_MESSAGE != WIN_ERR)
answer = wgetch(message_window);
else
answer = wgetch(askwin);
#else
answer = curses_read_char();
#endif
@@ -321,7 +332,7 @@ curses_character_input_dialog(
}
answer = def;
for (count = 0; choices[count] != '\0'; count++) {
if (choices[count] == 'q') { /* q is preferred over n */
if (choices[count] == 'q') { /* q is preferred over n */
answer = 'q';
} else if ((choices[count] == 'n') && answer != 'q') {
answer = 'n';
+1 -1
View File
@@ -1004,7 +1004,7 @@ curses_print_glyph(
#ifdef ENHANCED_SYMBOLS
(SYMHANDLING(H_UTF8)
&& glyphinfo->gm.u && glyphinfo->gm.u->utf8str)
? glyphinfo->gm.u : NULL,
? glyphinfo->gm.u : NULL,
#endif
(nhcolor != 0) ? nhcolor : color,
bkglyphinfo->framecolor, attr);