From ab03144d1c2dcb6b36f61f16f3ee9d547120efe1 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Fri, 1 Feb 2002 06:43:22 +0000 Subject: [PATCH] dead key fix Apparently, " is part of an accented character in US(international) keyboard layout (additional character specific to the language of an origin - for example, left and right double quotation marks). The code did not handle it too well since it maps to 2 ASCII characters instead of one (one of them is so called "dead" character). We can ignore the dead character as a workaround for this problem. The patch is attached. . --- win/win32/mhmain.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/win/win32/mhmain.c b/win/win32/mhmain.c index c6e904480..35db3c509 100644 --- a/win/win32/mhmain.c +++ b/win/win32/mhmain.c @@ -213,21 +213,22 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar return 0; default: { - WORD c[4]; + WORD c; BYTE kbd_state[256]; - + + c = 0; ZeroMemory(kbd_state, sizeof(kbd_state)); - ZeroMemory(c, sizeof(c)); GetKeyboardState(kbd_state); - - if( ToAscii( LOWORD(wParam), 0, kbd_state, c, 0)==1 ) { - NHEVENT_KBD(c[0]); + + if( ToAscii( wParam, (lParam>>16)&0xFF, kbd_state, &c, 0) ) { + NHEVENT_KBD( c&0xFF ); return 0; } else { return 1; } - } } + + } /* end switch */ } break; case WM_COMMAND: