From 4c7f2dfaac678f97f43fd13ad0277c0944271e9f Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 22 May 2026 12:21:42 -0400 Subject: [PATCH] some Windows curses adjustments dialog on startup --- sys/windows/windmain.c | 9 +++++++++ win/curses/cursdial.c | 33 ++++++++++++++++++++++----------- win/curses/cursmain.c | 2 +- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/sys/windows/windmain.c b/sys/windows/windmain.c index 3cb87f4f5..2cc92ac2a 100644 --- a/sys/windows/windmain.c +++ b/sys/windows/windmain.c @@ -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; } diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index b317c8543..e2bb44066 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -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'; diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 23f5e90f2..52b034410 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -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);