curses display sizes on Windows console, GUI

This commit is contained in:
nhmall
2026-05-20 08:55:28 -04:00
parent 93786ddfd9
commit f9165e66fc
+16 -28
View File
@@ -744,6 +744,12 @@ curses_character_dialog(const char **choices, const char *prompt)
void
curses_init_options(void)
{
#ifdef PDCURSES
int display_height = 0, display_width = 0;
#if defined(WIN32) && !defined(WIN32CON)
int alt_display_height = 0, alt_display_width = 0;
#endif
#endif
/* change these from set_gameview to set_in_game */
set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS, set_in_game);
@@ -761,36 +767,18 @@ curses_init_options(void)
terminal size programmatically. If the user does not specify a
size in the config file, we will set it to a nice big 32x110 to
take advantage of some of the nice features of this windowport. */
#if defined(WIN32)
if (iflags.wc2_term_cols == 0) {
int display_width = get_approx_display_cols();
if (display_width > 220)
display_width = 220;
if (display_width != 0)
iflags.wc2_term_cols = display_width;
else
iflags.wc2_term_cols = 110;
}
if (iflags.wc2_term_rows == 0) {
int display_height = get_approx_display_rows();
if (display_height > 64)
display_height = 64;
if (display_height != 0)
iflags.wc2_term_rows = display_height;
else
iflags.wc2_term_rows = 32;
}
#else
/* FIXME: should these be higher; is there a way to detect max there? */
if (iflags.wc2_term_cols == 0)
iflags.wc2_term_cols = 110;
if (iflags.wc2_term_rows == 0)
iflags.wc2_term_rows = 32;
getmaxyx(base_term, display_height, display_width);
#if defined(WIN32) && !defined(WIN32CON)
alt_display_width = get_approx_display_cols();
alt_display_height = get_approx_display_rows();
display_width = min(230, alt_display_width);
display_height = min(66, alt_display_height);
#endif
if (iflags.wc2_term_cols == 0)
iflags.wc2_term_cols = display_width;
if (iflags.wc2_term_rows == 0)
iflags.wc2_term_rows = display_height;
resize_term(iflags.wc2_term_rows, iflags.wc2_term_cols);
getmaxyx(base_term, term_rows, term_cols);