1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

New backend function to disable resizing.

Some protocols such as SUPDUP does not support resizing the terminal.
This commit is contained in:
Lars Brinkhoff
2020-02-14 13:49:56 +01:00
committed by Simon Tatham
parent 269bd7e309
commit e2b0e90c8c
5 changed files with 62 additions and 21 deletions

View File

@ -732,10 +732,16 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
{
int winmode = WS_OVERLAPPEDWINDOW | WS_VSCROLL;
int exwinmode = 0;
const struct BackendVtable *vt =
backend_vt_from_proto(be_default_protocol);
bool resize_forbidden = false;
if (vt && vt->flags & BACKEND_RESIZE_FORBIDDEN)
resize_forbidden = true;
wchar_t *uappname = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, appname);
if (!conf_get_bool(conf, CONF_scrollbar))
winmode &= ~(WS_VSCROLL);
if (conf_get_int(conf, CONF_resize_action) == RESIZE_DISABLED)
if (conf_get_int(conf, CONF_resize_action) == RESIZE_DISABLED ||
resize_forbidden)
winmode &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
if (conf_get_bool(conf, CONF_alwaysontop))
exwinmode |= WS_EX_TOPMOST;
@ -1741,6 +1747,7 @@ static void deinit_fonts(void)
static void wintw_request_resize(TermWin *tw, int w, int h)
{
const struct BackendVtable *vt;
int width, height;
/* If the window is maximized suppress resizing attempts */
@ -1750,6 +1757,9 @@ static void wintw_request_resize(TermWin *tw, int w, int h)
}
if (conf_get_int(conf, CONF_resize_action) == RESIZE_DISABLED) return;
vt = backend_vt_from_proto(be_default_protocol);
if (vt && vt->flags & BACKEND_RESIZE_FORBIDDEN)
return;
if (h == term->rows && w == term->cols) return;
/* Sanity checks ... */