mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
65 lines
2.8 KiB
Diff
65 lines
2.8 KiB
Diff
From c133a17f33a7cce87df6a56c7e265b1553726134 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
|
Date: Fri, 23 Aug 2024 08:52:34 +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 d9c73cd7367..407634967de 100644
|
|
--- a/dlls/dinput/keyboard.c
|
|
+++ b/dlls/dinput/keyboard.c
|
|
@@ -208,6 +208,7 @@ static BOOL enum_object( struct keyboard *impl, const DIPROPHEADER *filter, DWOR
|
|
static HRESULT enum_objects( struct keyboard *impl, const DIPROPHEADER *filter,
|
|
DWORD flags, enum_object_callback callback, void *data )
|
|
{
|
|
+ static const UINT vsc_base[] = {0, 0x100, 0x80, 0x180};
|
|
BYTE subtype = GET_DIDEVICE_SUBTYPE( impl->base.instance.dwDevType );
|
|
DIDEVICEOBJECTINSTANCEW instance =
|
|
{
|
|
@@ -217,18 +218,21 @@ static HRESULT enum_objects( struct keyboard *impl, const DIPROPHEADER *filter,
|
|
.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 = enum_object( impl, filter, flags, callback, index++, &instance, data );
|
|
- 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 = enum_object( impl, filter, flags, callback, index++, &instance, data );
|
|
+ if (ret != DIENUM_CONTINUE) return DIENUM_STOP;
|
|
+ }
|
|
}
|
|
|
|
return DIENUM_CONTINUE;
|
|
--
|
|
2.43.0
|
|
|