From dbeff1e16fe99acdb1d3b70786d7f0da10fc2680 Mon Sep 17 00:00:00 2001 From: falcon35180 Date: Sun, 18 Dec 2022 04:21:59 +1100 Subject: [PATCH] Added workaround for Wine RawInput keyboard handling --- od-win32/dinput.cpp | 5 ++++- od-win32/win32.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index e822602f..edc041b8 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -17,6 +17,7 @@ int tablet_log = 0; int no_rawinput = 0; int no_directinput = 0; int no_windowsmouse = 0; +int winekeyboard = 0; #define _WIN32_WINNT 0x501 /* enable RAWINPUT support */ @@ -2470,7 +2471,9 @@ static void handle_rawinput_2 (RAWINPUT *raw, LPARAM lParam) write_log (_T("VK->CODE: %x\n"), scancode); } - if (rk->VKey == 0xff || (rk->Flags & RI_KEY_E0)) + if (rk->VKey == 0xff || ((rk->Flags & RI_KEY_E0) && !(winekeyboard && rk->VKey == VK_NUMLOCK))) + scancode |= 0x80; + if (winekeyboard && rk->VKey == VK_PAUSE) scancode |= 0x80; if (rk->MakeCode == KEYBOARD_OVERRUN_MAKE_CODE) return; diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 83710288..72103dce 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -114,7 +114,7 @@ const static GUID GUID_DEVINTERFACE_MOUSE = { 0x378de44c, 0x56ef, 0x11d1, { 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd } }; extern int harddrive_dangerous, do_rdbdump; -extern int no_rawinput, no_directinput, no_windowsmouse; +extern int no_rawinput, no_directinput, no_windowsmouse, winekeyboard; extern int force_directsound; extern int log_a2065, a2065_promiscuous, log_ethernet; extern int rawinput_enabled_hid, rawinput_log; @@ -6429,6 +6429,10 @@ static int parseargs(const TCHAR *argx, const TCHAR *np, const TCHAR *np2) no_windowsmouse = 1; return 1; } + if (!_tcscmp(arg, _T("winekeyboard"))) { + winekeyboard = 1; + return 1; + } if (!_tcscmp(arg, _T("rawhid"))) { rawinput_enabled_hid = 1; return 1; -- 2.47.3