Rémi Bernon : dinput: Set high DIK bit for extended scancodes.

Alexandre Julliard julliard at winehq.org
Thu Oct 21 16:04:17 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Oct 21 18:07:46 2021 +0200

dinput: Set high DIK bit for extended scancodes.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51910
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index fb6cf33b911..fd8e9e8fd12 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -80,7 +80,8 @@ static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD vers
             break;
         }
     }
-    return scanCode;
+    if (scanCode & 0x100) scanCode |= 0x80;
+    return (BYTE)scanCode;
 }
 
 int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam )
@@ -89,6 +90,7 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa
     BYTE new_diks, subtype = GET_DIDEVICE_SUBTYPE( This->base.instance.dwDevType );
     int dik_code, ret = This->base.dwCoopLevel & DISCL_EXCLUSIVE;
     KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
+    DWORD scan_code;
 
     if (wparam != WM_KEYDOWN && wparam != WM_KEYUP &&
         wparam != WM_SYSKEYDOWN && wparam != WM_SYSKEYUP)
@@ -105,9 +107,9 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa
         case VK_NUMLOCK : dik_code = DIK_NUMLOCK; break;
         case VK_SUBTRACT: dik_code = DIK_SUBTRACT; break;
         default:
-            dik_code = map_dik_code( hook->scanCode & 0xff, hook->vkCode, subtype,
-                                     This->base.dinput->dwVersion );
-            if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
+            scan_code = hook->scanCode & 0xff;
+            if (hook->flags & LLKHF_EXTENDED) scan_code |= 0x100;
+            dik_code = map_dik_code( scan_code, hook->vkCode, subtype, This->base.dinput->dwVersion );
     }
     new_diks = hook->flags & LLKHF_UP ? 0 : 0x80;
 




More information about the wine-cvs mailing list