1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-12 18:13:50 -05:00

Handle the VK_PACKET virtual key code.

This is generated in response to the SendInput() Windows API call, if
that in turn is passed an KEYBDINPUT structure with KEYEVENTF_UNICODE
set. That method of input generation is used by programs such as
'WinCompose' to send an arbitrary Unicode character as if it had been
typed at the keyboard, even if the keyboard doesn't actually provide a
key for it.

Like VK_PROCESSKEY, this key code is an exception to our usual policy
of manually translating keystrokes: we handle it by calling
TranslateMessage, to get back the Unicode character it contains as a
WM_CHAR message.

(If that Unicode character in turn is outside the BMP, it may come
back as a pair of WM_CHARs in succession containing UTF-16 surrogates;
if so, that's OK, because the new Unicode WM_CHAR handler can cope.)

(cherry picked from commit 65f3500906c38ee3cf66cc75a015058e5bc6e56d)
This commit is contained in:
Simon Tatham 2015-07-27 20:06:02 +01:00
parent 3dfb9ac885
commit d4e5b0dd1c

View File

@ -76,6 +76,11 @@
#define WHEEL_DELTA 120
#endif
/* VK_PACKET, used to send Unicode characters in WM_KEYDOWNs */
#ifndef VK_PACKET
#define VK_PACKET 0xE7
#endif
static Mouse_Button translate_button(Mouse_Button button);
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
@ -3086,7 +3091,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
unsigned char buf[20];
int len;
if (wParam == VK_PROCESSKEY) { /* IME PROCESS key */
if (wParam == VK_PROCESSKEY || /* IME PROCESS key */
wParam == VK_PACKET) { /* 'this key is a Unicode char' */
if (message == WM_KEYDOWN) {
MSG m;
m.hwnd = hwnd;