Fix from Thomas Henlich for bug in dead key support. I've reproduced the
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Wed, 24 Mar 2004 14:53:51 +0000 (14:53 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Wed, 24 Mar 2004 14:53:51 +0000 (14:53 +0000)
problem and verified the fix on Win2K with the US-International keyboard layout.
(Closes: `win-dead-keys')
<20040323143836.GA40414@rcs.urz.tu-dresden.de>

git-svn-id: svn://svn.tartarus.org/sgt/putty@3963 cda61777-01e9-0310-a592-d414129be87e

window.c

index f13f0d4..14bedd8 100644 (file)
--- a/window.c
+++ b/window.c
@@ -3170,7 +3170,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
 
     HKL kbd_layout = GetKeyboardLayout(0);
 
-    static WORD keys[3];
+    /* keys is for ToAsciiEx; XXX do we know how big this needs to be? */
+    static BYTE keys[3];
     static int compose_char = 0;
     static WPARAM compose_key = 0;
 
@@ -3861,7 +3862,12 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
            keystate[VK_CAPITAL] = 0;
        }
 
-       r = ToAsciiEx(wParam, scan, keystate, keys, 0, kbd_layout);
+       /* 'keys' parameter is declared in MSDN documentation as
+        * 'LPWORD lpChar'. In 0.54 and below we took that to mean that
+        * 'keys' should be an array of WORD, but an array of BYTE works
+        * better on keyboard with dead keys, at least for Win2K/US-
+        * International and WinXP/German. Bletch. */
+       r = ToAsciiEx(wParam, scan, keystate, (LPWORD)keys, 0, kbd_layout);
 #ifdef SHOW_TOASCII_RESULT
        if (r == 1 && !key_down) {
            if (alt_sum) {