Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
d94ad65f
Commit
d94ad65f
authored
Oct 19, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Use the base device state in the keyboard device.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
50d60884
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
keyboard.c
dlls/dinput/keyboard.c
+12
-15
No files found.
dlls/dinput/keyboard.c
View file @
d94ad65f
...
...
@@ -34,8 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dinput
);
#define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
static
const
IDirectInputDevice8WVtbl
SysKeyboardWvt
;
static
const
struct
dinput_device_vtbl
keyboard_internal_vtbl
;
...
...
@@ -43,7 +41,6 @@ typedef struct SysKeyboardImpl SysKeyboardImpl;
struct
SysKeyboardImpl
{
struct
IDirectInputDeviceImpl
base
;
BYTE
DInputKeyState
[
WINE_DINPUT_KEYBOARD_MAX_KEYS
];
};
static
inline
SysKeyboardImpl
*
impl_from_IDirectInputDevice8W
(
IDirectInputDevice8W
*
iface
)
...
...
@@ -115,11 +112,10 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa
new_diks
=
hook
->
flags
&
LLKHF_UP
?
0
:
0x80
;
/* returns now if key event already known */
if
(
new_diks
==
This
->
DInputKeyState
[
dik_code
])
return
ret
;
if
(
new_diks
==
This
->
base
.
device_state
[
dik_code
])
return
ret
;
This
->
DInputKeyS
tate
[
dik_code
]
=
new_diks
;
TRACE
(
" setting %02X to %02X
\n
"
,
dik_code
,
This
->
DInputKeyState
[
dik_code
]
);
This
->
base
.
device_s
tate
[
dik_code
]
=
new_diks
;
TRACE
(
" setting key %02x to %02x
\n
"
,
dik_code
,
This
->
base
.
device_state
[
dik_code
]
);
EnterCriticalSection
(
&
This
->
base
.
crit
);
queue_event
(
iface
,
DIDFT_MAKEINSTANCE
(
dik_code
)
|
DIDFT_PSHBUTTON
,
...
...
@@ -248,6 +244,8 @@ const struct dinput_device keyboard_device = {
static
HRESULT
WINAPI
SysKeyboardWImpl_GetDeviceState
(
LPDIRECTINPUTDEVICE8W
iface
,
DWORD
len
,
LPVOID
ptr
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
DWORD
i
;
TRACE
(
"(%p)->(%d,%p)
\n
"
,
This
,
len
,
ptr
);
if
(
!
This
->
base
.
acquired
)
return
DIERR_NOTACQUIRED
;
...
...
@@ -259,15 +257,14 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W ifac
EnterCriticalSection
(
&
This
->
base
.
crit
);
if
(
TRACE_ON
(
dinput
))
{
int
i
;
for
(
i
=
0
;
i
<
WINE_DINPUT_KEYBOARD_MAX_KEYS
;
i
++
)
{
if
(
This
->
DInputKeyState
[
i
]
!=
0x00
)
TRACE
(
" - %02X: %02x
\n
"
,
i
,
This
->
DInputKeyState
[
i
]);
}
if
(
TRACE_ON
(
dinput
))
{
TRACE
(
"pressed keys:"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
This
->
base
.
device_state
[
i
])
TRACE
(
" %02x"
,
i
);
TRACE
(
"
\n
"
);
}
fill_DataFormat
(
ptr
,
len
,
This
->
DInputKeyState
,
&
This
->
base
.
data_format
);
fill_DataFormat
(
ptr
,
len
,
This
->
base
.
device_state
,
&
This
->
base
.
data_format
);
LeaveCriticalSection
(
&
This
->
base
.
crit
);
return
DI_OK
;
...
...
@@ -281,7 +278,7 @@ static HRESULT keyboard_internal_acquire( IDirectInputDevice8W *iface )
static
HRESULT
keyboard_internal_unacquire
(
IDirectInputDevice8W
*
iface
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
memset
(
This
->
DInputKeyState
,
0
,
sizeof
(
This
->
DInputKeyS
tate
)
);
memset
(
This
->
base
.
device_state
,
0
,
sizeof
(
This
->
base
.
device_s
tate
)
);
return
DI_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment