mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added dinput-scancode patchset
This commit is contained in:
parent
01fbf6d356
commit
a6448966cf
@ -0,0 +1,34 @@
|
||||
From b2764b3d21a64c3c194b29b9cb71379456e03b06 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 7 Jul 2023 12:44:26 +0200
|
||||
Subject: [PATCH] dinput: Avoid duplicated objects in keyboard devices.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55205
|
||||
---
|
||||
dlls/dinput/keyboard.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
|
||||
index cbcbf94f0f6..3fd75bb10e6 100644
|
||||
--- a/dlls/dinput/keyboard.c
|
||||
+++ b/dlls/dinput/keyboard.c
|
||||
@@ -265,13 +265,15 @@ static HRESULT keyboard_enum_objects( IDirectInputDevice8W *iface, const DIPROPH
|
||||
.dwOfs = DIK_ESCAPE,
|
||||
.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( DIK_ESCAPE ),
|
||||
};
|
||||
+ BOOL ret, mapped[0x100] = {0};
|
||||
DWORD index, i, dik;
|
||||
- BOOL ret;
|
||||
|
||||
for (i = 0, index = 0; i < 512; ++i)
|
||||
{
|
||||
if (!GetKeyNameTextW( i << 16, instance.tszName, ARRAY_SIZE(instance.tszName) )) continue;
|
||||
if (!(dik = map_dik_code( i, 0, subtype, impl->base.dinput->dwVersion ))) continue;
|
||||
+ if (mapped[dik]) continue;
|
||||
+ mapped[dik] = TRUE;
|
||||
instance.dwOfs = dik;
|
||||
instance.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( dik );
|
||||
ret = try_enum_object( &impl->base, filter, flags, callback, index++, &instance, context );
|
||||
--
|
||||
2.40.1
|
||||
|
@ -0,0 +1,64 @@
|
||||
From bdf952bf0711a7cf22fee840197234bd413ae611 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 7 Jul 2023 12:45:04 +0200
|
||||
Subject: [PATCH] dinput: Enumerate lower keyboard scancodes values first.
|
||||
|
||||
Windows usually doesn't have scancodes higher than 0x7f, or extended
|
||||
scancodes higher than 0x17f, but X11 does for several XF86 keys.
|
||||
|
||||
We want to enumerate the basic keys first including in the extended
|
||||
scancode range, so they appear before the XF86 keys in the dinput
|
||||
device object list.
|
||||
|
||||
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55205
|
||||
---
|
||||
dlls/dinput/keyboard.c | 24 ++++++++++++++----------
|
||||
1 file changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
|
||||
index 3fd75bb10e6..1f1db883b80 100644
|
||||
--- a/dlls/dinput/keyboard.c
|
||||
+++ b/dlls/dinput/keyboard.c
|
||||
@@ -256,6 +256,7 @@ static BOOL try_enum_object( struct dinput_device *impl, const DIPROPHEADER *fil
|
||||
static HRESULT keyboard_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter,
|
||||
DWORD flags, enum_object_callback callback, void *context )
|
||||
{
|
||||
+ static const UINT vsc_base[] = {0, 0x100, 0x80, 0x180};
|
||||
struct keyboard *impl = impl_from_IDirectInputDevice8W( iface );
|
||||
BYTE subtype = GET_DIDEVICE_SUBTYPE( impl->base.instance.dwDevType );
|
||||
DIDEVICEOBJECTINSTANCEW instance =
|
||||
@@ -266,18 +267,21 @@ static HRESULT keyboard_enum_objects( IDirectInputDevice8W *iface, const DIPROPH
|
||||
.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( DIK_ESCAPE ),
|
||||
};
|
||||
BOOL ret, mapped[0x100] = {0};
|
||||
- DWORD index, i, dik;
|
||||
+ DWORD index, i, dik, vsc;
|
||||
|
||||
- for (i = 0, index = 0; i < 512; ++i)
|
||||
+ for (i = 0, index = 0; i < ARRAY_SIZE(vsc_base); ++i)
|
||||
{
|
||||
- if (!GetKeyNameTextW( i << 16, instance.tszName, ARRAY_SIZE(instance.tszName) )) continue;
|
||||
- if (!(dik = map_dik_code( i, 0, subtype, impl->base.dinput->dwVersion ))) continue;
|
||||
- if (mapped[dik]) continue;
|
||||
- mapped[dik] = TRUE;
|
||||
- instance.dwOfs = dik;
|
||||
- instance.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( dik );
|
||||
- ret = try_enum_object( &impl->base, filter, flags, callback, index++, &instance, context );
|
||||
- if (ret != DIENUM_CONTINUE) return DIENUM_STOP;
|
||||
+ for (vsc = vsc_base[i]; vsc < vsc_base[i] + 0x80; vsc++)
|
||||
+ {
|
||||
+ if (!GetKeyNameTextW( vsc << 16, instance.tszName, ARRAY_SIZE(instance.tszName) )) continue;
|
||||
+ if (!(dik = map_dik_code( vsc, 0, subtype, impl->base.dinput->dwVersion ))) continue;
|
||||
+ if (mapped[dik]) continue;
|
||||
+ mapped[dik] = TRUE;
|
||||
+ instance.dwOfs = dik;
|
||||
+ instance.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( dik );
|
||||
+ ret = try_enum_object( &impl->base, filter, flags, callback, index++, &instance, context );
|
||||
+ if (ret != DIENUM_CONTINUE) return DIENUM_STOP;
|
||||
+ }
|
||||
}
|
||||
|
||||
return DIENUM_CONTINUE;
|
||||
--
|
||||
2.40.1
|
||||
|
2
patches/dinput-scancode/definition
Normal file
2
patches/dinput-scancode/definition
Normal file
@ -0,0 +1,2 @@
|
||||
Fixes: [55205] dinput: Improve keyboard devices scancode support.
|
||||
# PR 3264
|
Loading…
Reference in New Issue
Block a user