more Windows curses size tinkering

This commit is contained in:
nhmall
2026-05-16 12:15:20 -04:00
parent b2458e679a
commit d78a875110
5 changed files with 31 additions and 44 deletions
+4 -4
View File
@@ -2033,8 +2033,8 @@ extern int win32_cr_gettrace(int, char *, int);
extern int *win32_cr_shellexecute(const char *);
# endif
#ifdef MSWIN_GRAPHICS
extern int get_approx_window_column_width(void);
extern int get_approx_window_rows(void);
extern int get_approx_display_width(void);
extern int get_approx_display_rows(void);
#endif
#endif /* WIN32 */
@@ -2185,8 +2185,8 @@ void console_g_putch(int in_ch);
extern void set_output_mode(int);
extern void synch_cursor(void);
extern void nethack_enter_consoletty(void);
extern int get_console_width(void);
extern int get_console_height(void);
extern int get_approx_display_cols(void);
extern int get_approx_display_rows(void);
extern void console_exit(void);
extern int set_keyhandling_via_option(void);
#ifdef ENHANCED_SYMBOLS
+2 -2
View File
@@ -2644,13 +2644,13 @@ void nethack_enter_consoletty(void)
}
int
get_console_width(void)
get_approx_display_cols(void)
{
return console.width;
}
int
get_console_height(void)
get_approx_display_rows(void)
{
return console.height;
}
-12
View File
@@ -1252,18 +1252,6 @@ error:
}
#undef win32err
#ifdef MSWIN_GRAPHICS
int
get_approx_window_column_width(void)
{
return GetSystemMetrics(SM_CXSCREEN) / 8;
}
int
get_approx_window_rows(void)
{
return GetSystemMetrics(SM_CYSCREEN) / 12;
}
#endif
#include <shellapi.h>
#define MAX_SYM_SIZE 100
+12 -26
View File
@@ -762,40 +762,26 @@ curses_init_options(void)
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 (iflags.wc2_term_cols == 0) {
#ifndef MSWIN_GRAPHICS
int console_width = get_console_width();
int display_width = get_approx_display_cols();
if (console_width != 0)
iflags.wc2_term_cols = console_width;
if (display_width > 220)
display_width = 220;
if (display_width != 0)
iflags.wc2_term_cols = display_width;
else
iflags.wc2_term_cols = 110;
#else
int width = get_approx_window_column_width();
if (width > 220)
width = 220;
if (width != 0)
iflags.wc2_term_cols = width;
else
iflags.wc2_term_cols = 110;
#endif
}
if (iflags.wc2_term_rows == 0) {
#ifndef MSWIN_GRAPHICS
int console_height = get_console_height();
int display_height = get_approx_display_rows();
if (console_height != 0)
iflags.wc2_term_rows = console_height;
if (display_height > 64)
display_height = 64;
if (display_height != 0)
iflags.wc2_term_rows = display_height;
else
iflags.wc2_term_rows = 32;
#else
int scrows = get_approx_window_rows();
if (scrows > 54)
scrows = 54;
iflags.wc2_term_rows = scrows ? scrows : 32;
#endif
}
resize_term(iflags.wc2_term_rows, iflags.wc2_term_cols);
getmaxyx(base_term, term_rows, term_cols);
+13
View File
@@ -1361,6 +1361,19 @@ nh_compose_ascii_screenshot(void)
return retval;
}
int
get_approx_display_cols(void)
{
return GetSystemMetrics(SM_CXSCREEN) / 8;
}
int
get_approx_display_rows(void)
{
return GetSystemMetrics(SM_CYSCREEN) / 12;
}
#ifdef ENHANCED_SYMBOLS
// returns malloc() created pointer - callee assumes the ownership
static WCHAR *