]> granicus.if.org Git - nethack/commitdiff
dead key fix
authornethack.allison <nethack.allison>
Fri, 1 Feb 2002 06:43:22 +0000 (06:43 +0000)
committernethack.allison <nethack.allison>
Fri, 1 Feb 2002 06:43:22 +0000 (06:43 +0000)
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>.

win/win32/mhmain.c

index c6e904480bacab71eede1664e3007b0661a75c19..35db3c509e5bbc2c27ed1164df089256140cd2be 100644 (file)
@@ -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: