X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/5b7ce734d2e126ebebf27b0a6ece1db672cd3eae..e1c8e0ed0663eee368ce8f98380a7eae7ae93230:/window.c diff --git a/window.c b/window.c index 8c2d96c9..14ab3d69 100644 --- a/window.c +++ b/window.c @@ -149,6 +149,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { default_protocol = DEFAULT_PROTOCOL; default_port = DEFAULT_PORT; + cfg.logtype = LGTYP_NONE; do_defaults(NULL, &cfg); @@ -169,11 +170,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { tolower(p[2]) == 'h') { default_protocol = cfg.protocol = PROT_SSH; default_port = cfg.port = 22; - } else if (q == p + 3 && - tolower(p[0]) == 'l' && - tolower(p[1]) == 'o' && - tolower(p[2]) == 'g') { - logfile = "putty.log"; } else if (q == p + 7 && tolower(p[0]) == 'c' && tolower(p[1]) == 'l' && @@ -537,6 +533,11 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { ShowWindow (hwnd, show); /* + * Open the initial log file if there is one. + */ + logfopen(); + + /* * Set the palette up. */ pal = NULL; @@ -1060,6 +1061,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, static int ignore_clip = FALSE; static int just_reconfigged = FALSE; static int resizing = FALSE; + static int need_backend_resize = FALSE; switch (message) { case WM_TIMER: @@ -1170,11 +1172,27 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, case IDM_RECONF: { int prev_alwaysontop = cfg.alwaysontop; + char oldlogfile[FILENAME_MAX]; + int oldlogtype; int need_setwpos = FALSE; + int old_fwidth, old_fheight; + + strcpy(oldlogfile, cfg.logfilename); + oldlogtype = cfg.logtype; cfg.width = cols; cfg.height = rows; + old_fwidth = font_width; + old_fheight = font_height; + if (!do_reconfig(hwnd)) break; + + if (strcmp(oldlogfile, cfg.logfilename) || + oldlogtype != cfg.logtype) { + logfclose(); /* reset logging */ + logfopen(); + } + just_reconfigged = TRUE; { int i; @@ -1250,6 +1268,8 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, if (cfg.height != rows || cfg.width != cols || + old_fwidth != font_width || + old_fheight != font_height || cfg.savelines != savelines) need_setwpos = TRUE; term_size(cfg.height, cfg.width, cfg.savelines); @@ -1417,11 +1437,13 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, case WM_ENTERSIZEMOVE: EnableSizeTip(1); resizing = TRUE; + need_backend_resize = FALSE; break; case WM_EXITSIZEMOVE: EnableSizeTip(0); resizing = FALSE; - back->size(); + if (need_backend_resize) + back->size(); break; case WM_SIZING: { @@ -1497,6 +1519,8 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, */ if (!resizing) back->size(); + else + need_backend_resize = TRUE; just_reconfigged = FALSE; } }