Dmitry Timoshkov : dinput: The DIK_ key code should match the scan code.

Alexandre Julliard julliard at winehq.org
Tue Apr 17 14:53:58 CDT 2018


Module: wine
Branch: master
Commit: d341b0a86b0d6264677635ba658535a63509b8bc
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d341b0a86b0d6264677635ba658535a63509b8bc

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Mon Apr 16 22:30:47 2018 +0800

dinput: The DIK_ key code should match the scan code.

This reverts commit 304ff3c7280a53b7cbadfa83eaeda458ff5959d1.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/keyboard.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 4c3c38e..e1ba15e 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -69,26 +69,10 @@ static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysKeyboardIm
 
 static BYTE map_dik_code(DWORD scanCode, DWORD vkCode)
 {
-    static const BYTE asciiCodes[] =
-     {/*32*/  DIK_SPACE,0,0,0,0,0,0,DIK_APOSTROPHE,
-      /*40*/  0,0,0,0,DIK_COMMA,DIK_MINUS,DIK_PERIOD,DIK_SLASH,
-      /*48*/  DIK_0,DIK_1,DIK_2,DIK_3,DIK_4,DIK_5,DIK_6,DIK_7,
-      /*56*/  DIK_8,DIK_9,DIK_COLON,DIK_SEMICOLON,0,DIK_EQUALS,0,0,
-      /*64*/  DIK_AT,DIK_A,DIK_B,DIK_C,DIK_D,DIK_E,DIK_F,DIK_G,
-      /*72*/  DIK_H,DIK_I,DIK_J,DIK_K,DIK_L,DIK_M,DIK_N,DIK_O,
-      /*80*/  DIK_P,DIK_Q,DIK_R,DIK_S,DIK_T,DIK_U,DIK_V,DIK_W,
-      /*88*/  DIK_X,DIK_Y,DIK_Z,DIK_LBRACKET,0,DIK_RBRACKET,DIK_CIRCUMFLEX,DIK_UNDERLINE}      /*95*/ ;
-
-    BYTE out_code = 0;
-    WCHAR c = MapVirtualKeyW(vkCode,MAPVK_VK_TO_CHAR);
-
-    if (c > 31 && c < 96)
-        out_code = asciiCodes[c - 32];
-
-    if (out_code == 0)
-        out_code = scanCode;
-
-    return out_code;
+    if (!scanCode)
+        scanCode = MapVirtualKeyW(vkCode, MAPVK_VK_TO_VSC);
+
+    return scanCode;
 }
 
 static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )




More information about the wine-cvs mailing list