X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/b278b14a860b1aec4555d9b1862e5bdf722c7d38..3ad8c6db2a0d488f0d8fa23d8e71306572df8ff2:/window.c?ds=sidebyside diff --git a/window.c b/window.c index 46d9f7ee..f810eba9 100644 --- a/window.c +++ b/window.c @@ -426,6 +426,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { caretbm = CreateBitmap(font_width, font_height, 1, 1, bits); sfree(bits); } + CreateCaret(hwnd, caretbm, font_width, font_height); /* * Initialise the scroll bar. @@ -1059,6 +1060,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: @@ -1169,6 +1171,12 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, case IDM_RECONF: { int prev_alwaysontop = cfg.alwaysontop; + int need_setwpos = FALSE; + int old_fwidth, old_fheight; + cfg.width = cols; + cfg.height = rows; + old_fwidth = font_width; + old_fheight = font_height; if (!do_reconfig(hwnd)) break; just_reconfigged = TRUE; @@ -1231,6 +1239,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, SetWindowLong(hwnd, GWL_EXSTYLE, nexflag); SendMessage (hwnd, WM_IGNORE_SIZE, 0, 0); + SetWindowPos(hwnd, NULL, 0,0,0,0, SWP_NOACTIVATE|SWP_NOCOPYBITS| SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER| @@ -1243,13 +1252,22 @@ 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); InvalidateRect(hwnd, NULL, TRUE); - SetWindowPos (hwnd, NULL, 0, 0, - extra_width + font_width * cfg.width, - extra_height + font_height * cfg.height, - SWP_NOACTIVATE | SWP_NOCOPYBITS | - SWP_NOMOVE | SWP_NOZORDER); + if (need_setwpos) { + force_normal(hwnd); + SetWindowPos (hwnd, NULL, 0, 0, + extra_width + font_width * cfg.width, + extra_height + font_height * cfg.height, + SWP_NOACTIVATE | SWP_NOCOPYBITS | + SWP_NOMOVE | SWP_NOZORDER); + } if (IsIconic(hwnd)) { SetWindowText (hwnd, cfg.win_name_always ? window_name : icon_name); @@ -1387,7 +1405,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, return 0; case WM_SETFOCUS: has_focus = TRUE; - CreateCaret(hwnd, caretbm, 0, 0); + CreateCaret(hwnd, caretbm, font_width, font_height); ShowCaret(hwnd); compose_state = 0; term_out(); @@ -1405,11 +1423,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: { @@ -1485,6 +1505,8 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message, */ if (!resizing) back->size(); + else + need_backend_resize = TRUE; just_reconfigged = FALSE; } }