X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/8788a4162555db2ab0b9c6e912ea82e450ac0777..43e95114cbfc44a5d3a6f1adeff986cb5cd12f78:/windows/window.c diff --git a/windows/window.c b/windows/window.c index 3d865e7f..8448ca34 100644 --- a/windows/window.c +++ b/windows/window.c @@ -108,7 +108,7 @@ static void *backhandle; static struct unicode_data ucsdata; static int session_closed; -static int reconfiguring; +static int reconfiguring = FALSE; static const struct telnet_special *specials; static int n_specials; @@ -479,6 +479,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) sfree(s1); sfree(s2); exit(0); + } else if (!strcmp(p, "-pgpfp")) { + pgp_fingerprints(); + exit(1); } else if (*p != '-') { char *q = p; if (got_host) { @@ -1293,24 +1296,11 @@ static void init_fonts(int pick_width, int pick_height) f(FONT_NORMAL, cfg.font.charset, fw_dontcare, FALSE); - lfont.lfHeight = font_height; - lfont.lfWidth = font_width; - lfont.lfEscapement = 0; - lfont.lfOrientation = 0; - lfont.lfWeight = fw_dontcare; - lfont.lfItalic = FALSE; - lfont.lfUnderline = FALSE; - lfont.lfStrikeOut = FALSE; - lfont.lfCharSet = cfg.font.charset; - lfont.lfOutPrecision = OUT_DEFAULT_PRECIS; - lfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; - lfont.lfQuality = DEFAULT_QUALITY; - lfont.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE; - strncpy(lfont.lfFaceName, cfg.font.name, LF_FACESIZE); - SelectObject(hdc, fonts[FONT_NORMAL]); GetTextMetrics(hdc, &tm); + GetObject(fonts[FONT_NORMAL], sizeof(LOGFONT), &lfont); + if (pick_width == 0 || pick_height == 0) { font_height = tm.tmHeight; font_width = tm.tmAveCharWidth; @@ -1978,16 +1968,20 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, { Config prev_cfg; int init_lvl = 1; + int reconfig_result; if (reconfiguring) - break; + break; else - reconfiguring = TRUE; + reconfiguring = TRUE; GetWindowText(hwnd, cfg.wintitle, sizeof(cfg.wintitle)); prev_cfg = cfg; - if (!do_reconfig(hwnd, back ? back->cfg_info(backhandle) : 0)) + reconfig_result = + do_reconfig(hwnd, back ? back->cfg_info(backhandle) : 0); + reconfiguring = FALSE; + if (!reconfig_result) break; { @@ -2120,7 +2114,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, InvalidateRect(hwnd, NULL, TRUE); reset_window(init_lvl); net_pending_errors(); - reconfiguring = FALSE; } break; case IDM_COPYALL: @@ -2741,13 +2734,15 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, unsigned char buf[20]; int len; - if (wParam == VK_PROCESSKEY) { - MSG m; - m.hwnd = hwnd; - m.message = WM_KEYDOWN; - m.wParam = wParam; - m.lParam = lParam & 0xdfff; - TranslateMessage(&m); + if (wParam == VK_PROCESSKEY) { /* IME PROCESS key */ + if (message == WM_KEYDOWN) { + MSG m; + m.hwnd = hwnd; + m.message = WM_KEYDOWN; + m.wParam = wParam; + m.lParam = lParam & 0xdfff; + TranslateMessage(&m); + } else break; /* pass to Windows for default processing */ } else { len = TranslateKey(message, wParam, lParam, buf); if (len == -1) @@ -2785,12 +2780,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, set_input_locale((HKL)lParam); sys_cursor_update(); break; - case WM_IME_NOTIFY: - if(wParam == IMN_SETOPENSTATUS) { + case WM_IME_STARTCOMPOSITION: + { HIMC hImc = ImmGetContext(hwnd); ImmSetCompositionFont(hImc, &lfont); ImmReleaseContext(hwnd, hImc); - return 0; } break; case WM_IME_COMPOSITION: @@ -2931,6 +2925,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } } + /* + * Any messages we don't process completely above are passed through to + * DefWindowProc() for default processing. + */ return DefWindowProc(hwnd, message, wParam, lParam); }