[console] Fix server console resize

I goofed when doing the win32 fixes
This commit is contained in:
Bill Currie 2020-03-23 16:01:07 +09:00
parent eb386826d3
commit 178c8dec85

View file

@ -342,13 +342,12 @@ static void
sigwinch (int sig) sigwinch (int sig)
{ {
interrupted = 1; interrupted = 1;
signal (SIGWINCH, sigwinch);
} }
#endif #endif
static void static void
get_size (int *xlen, int *ylen) get_size (int *xlen, int *ylen)
{ {
#if 0 #ifdef SIGWINCH
struct winsize size; struct winsize size;
*xlen = *ylen = 0; *xlen = *ylen = 0;
@ -356,8 +355,9 @@ get_size (int *xlen, int *ylen)
return; return;
*xlen = size.ws_col; *xlen = size.ws_col;
*ylen = size.ws_row; *ylen = size.ws_row;
#endif #else
getmaxyx (stdscr, *ylen, *xlen); getmaxyx (stdscr, *ylen, *xlen);
#endif
} }
static void static void
@ -366,10 +366,11 @@ process_input (void)
int ch; int ch;
int escape = 0; int escape = 0;
if (interrupted) { if (__builtin_expect (interrupted, 0)) {
#ifdef SIGWINCH
interrupted = 0; interrupted = 0;
#ifdef SIGWINCH
get_size (&screen_x, &screen_y); get_size (&screen_x, &screen_y);
Sys_MaskPrintf (SYS_DEV, "resizing to %d x %d\n", screen_x, screen_y);
resizeterm (screen_y, screen_x); resizeterm (screen_y, screen_x);
con_linewidth = screen_x; con_linewidth = screen_x;
view_resize (sv_con_data.view, screen_x, screen_y); view_resize (sv_con_data.view, screen_x, screen_y);
@ -570,7 +571,9 @@ static void
init (void) init (void)
{ {
#ifdef SIGWINCH #ifdef SIGWINCH
signal (SIGWINCH, sigwinch); struct sigaction action = {};
action.sa_handler = sigwinch;
sigaction (SIGWINCH, &action, 0);
#endif #endif
initscr (); initscr ();