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.

<Someone>.
This commit is contained in:
nethack.allison
2002-02-01 06:43:22 +00:00
parent 3b6d7a76a6
commit ab03144d1c
+8 -7
View File
@@ -213,21 +213,22 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
return 0; return 0;
default: { default: {
WORD c[4]; WORD c;
BYTE kbd_state[256]; BYTE kbd_state[256];
c = 0;
ZeroMemory(kbd_state, sizeof(kbd_state)); ZeroMemory(kbd_state, sizeof(kbd_state));
ZeroMemory(c, sizeof(c));
GetKeyboardState(kbd_state); GetKeyboardState(kbd_state);
if( ToAscii( LOWORD(wParam), 0, kbd_state, c, 0)==1 ) { if( ToAscii( wParam, (lParam>>16)&0xFF, kbd_state, &c, 0) ) {
NHEVENT_KBD(c[0]); NHEVENT_KBD( c&0xFF );
return 0; return 0;
} else { } else {
return 1; return 1;
} }
}
} }
} /* end switch */
} break; } break;
case WM_COMMAND: case WM_COMMAND: