1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

`Change Settings' now behaves sensibly w.r.t. window size.

[originally from svn r841]
This commit is contained in:
Simon Tatham 2001-01-07 16:27:48 +00:00
parent fc478e6cad
commit f2b13650c8
3 changed files with 19 additions and 9 deletions

View File

@ -284,6 +284,7 @@ void showabout (HWND);
void verify_ssh_host_key(char *host, int port, char *keytype, void verify_ssh_host_key(char *host, int port, char *keytype,
char *keystr, char *fingerprint); char *keystr, char *fingerprint);
void registry_cleanup(void); void registry_cleanup(void);
void force_normal(HWND hwnd);
GLOBAL int nsessions; GLOBAL int nsessions;
GLOBAL char **sessions; GLOBAL char **sessions;

View File

@ -17,7 +17,7 @@ static HWND logbox = NULL, abtbox = NULL;
static int readytogo; static int readytogo;
static void force_normal(HWND hwnd) void force_normal(HWND hwnd)
{ {
static int recurse = 0; static int recurse = 0;
@ -27,7 +27,7 @@ static void force_normal(HWND hwnd)
recurse = 1; recurse = 1;
wp.length = sizeof(wp); wp.length = sizeof(wp);
if (GetWindowPlacement(hwnd, &wp)) if (GetWindowPlacement(hwnd, &wp) && wp.showCmd == SW_SHOWMAXIMIZED)
{ {
wp.showCmd = SW_SHOWNORMAL; wp.showCmd = SW_SHOWNORMAL;
SetWindowPlacement(hwnd, &wp); SetWindowPlacement(hwnd, &wp);
@ -1787,8 +1787,6 @@ int do_reconfig (HWND hwnd) {
ret = DialogBox (hinst, MAKEINTRESOURCE(IDD_RECONF), hwnd, ReconfDlgProc); ret = DialogBox (hinst, MAKEINTRESOURCE(IDD_RECONF), hwnd, ReconfDlgProc);
if (!ret) if (!ret)
cfg = backup_cfg; /* structure copy */ cfg = backup_cfg; /* structure copy */
else
force_normal(hwnd);
return ret; return ret;
} }

View File

@ -1169,6 +1169,9 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
case IDM_RECONF: case IDM_RECONF:
{ {
int prev_alwaysontop = cfg.alwaysontop; int prev_alwaysontop = cfg.alwaysontop;
int need_setwpos = FALSE;
cfg.width = cols;
cfg.height = rows;
if (!do_reconfig(hwnd)) if (!do_reconfig(hwnd))
break; break;
just_reconfigged = TRUE; just_reconfigged = TRUE;
@ -1231,6 +1234,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
SetWindowLong(hwnd, GWL_EXSTYLE, nexflag); SetWindowLong(hwnd, GWL_EXSTYLE, nexflag);
SendMessage (hwnd, WM_IGNORE_SIZE, 0, 0); SendMessage (hwnd, WM_IGNORE_SIZE, 0, 0);
SetWindowPos(hwnd, NULL, 0,0,0,0, SetWindowPos(hwnd, NULL, 0,0,0,0,
SWP_NOACTIVATE|SWP_NOCOPYBITS| SWP_NOACTIVATE|SWP_NOCOPYBITS|
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER| SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|
@ -1243,13 +1247,20 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
} }
} }
if (cfg.height != rows ||
cfg.width != cols ||
cfg.savelines != savelines)
need_setwpos = TRUE;
term_size(cfg.height, cfg.width, cfg.savelines); term_size(cfg.height, cfg.width, cfg.savelines);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
SetWindowPos (hwnd, NULL, 0, 0, if (need_setwpos) {
extra_width + font_width * cfg.width, force_normal(hwnd);
extra_height + font_height * cfg.height, SetWindowPos (hwnd, NULL, 0, 0,
SWP_NOACTIVATE | SWP_NOCOPYBITS | extra_width + font_width * cfg.width,
SWP_NOMOVE | SWP_NOZORDER); extra_height + font_height * cfg.height,
SWP_NOACTIVATE | SWP_NOCOPYBITS |
SWP_NOMOVE | SWP_NOZORDER);
}
if (IsIconic(hwnd)) { if (IsIconic(hwnd)) {
SetWindowText (hwnd, SetWindowText (hwnd,
cfg.win_name_always ? window_name : icon_name); cfg.win_name_always ? window_name : icon_name);