utilize more real estate on Windows GUI curses

Some inventory items were being hidden in a lengthy list.
This commit is contained in:
nhmall
2026-05-15 01:21:45 -04:00
parent accb14b797
commit 99f559fe18
3 changed files with 34 additions and 2 deletions
+4
View File
@@ -2031,6 +2031,10 @@ extern int win32_cr_helper(char, struct CRctxt *, void *, int);
extern int win32_cr_gettrace(int, char *, int); extern int win32_cr_gettrace(int, char *, int);
extern int *win32_cr_shellexecute(const char *); extern int *win32_cr_shellexecute(const char *);
# endif # endif
#ifdef MSWIN_GRAPHICS
extern int get_approx_window_column_width(void);
extern int get_approx_window_rows(void);
#endif
#endif /* WIN32 */ #endif /* WIN32 */
#endif /* MICRO || WIN32 */ #endif /* MICRO || WIN32 */
+12
View File
@@ -1252,6 +1252,18 @@ error:
} }
#undef win32err #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> #include <shellapi.h>
#define MAX_SYM_SIZE 100 #define MAX_SYM_SIZE 100
+18 -2
View File
@@ -768,8 +768,18 @@ curses_init_options(void)
if (console_width != 0) if (console_width != 0)
iflags.wc2_term_cols = console_width; iflags.wc2_term_cols = console_width;
else else
#endif
iflags.wc2_term_cols = 110; 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) { if (iflags.wc2_term_rows == 0) {
#ifndef MSWIN_GRAPHICS #ifndef MSWIN_GRAPHICS
@@ -778,8 +788,14 @@ curses_init_options(void)
if (console_height != 0) if (console_height != 0)
iflags.wc2_term_rows = console_height; iflags.wc2_term_rows = console_height;
else else
#endif
iflags.wc2_term_rows = 32; 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); resize_term(iflags.wc2_term_rows, iflags.wc2_term_cols);
getmaxyx(base_term, term_rows, term_cols); getmaxyx(base_term, term_rows, term_cols);