Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
35e4a577
Commit
35e4a577
authored
Jan 22, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Introduce a new struct to keep input thread state.
parent
15c12fd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
dinput_main.c
dlls/dinput/dinput_main.c
+15
-10
No files found.
dlls/dinput/dinput_main.c
View file @
35e4a577
...
...
@@ -46,6 +46,12 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dinput
);
struct
input_thread_state
{
UINT
events_count
;
HANDLE
events
[
128
];
};
static
inline
struct
dinput_device
*
impl_from_IDirectInputDevice8W
(
IDirectInputDevice8W
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
dinput_device
,
IDirectInputDevice8W_iface
);
...
...
@@ -233,11 +239,10 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam
static
DWORD
WINAPI
dinput_thread_proc
(
void
*
params
)
{
HANDLE
events
[
128
],
start_event
=
params
;
HANDLE
finished_event
,
start_event
=
params
;
struct
input_thread_state
state
=
{
0
};
static
HHOOK
kbd_hook
,
mouse_hook
;
struct
dinput_device
*
impl
,
*
next
;
SIZE_T
events_count
=
0
;
HANDLE
finished_event
;
DWORD
ret
;
MSG
msg
;
...
...
@@ -247,16 +252,16 @@ static DWORD WINAPI dinput_thread_proc( void *params )
PeekMessageW
(
&
msg
,
0
,
0
,
0
,
PM_NOREMOVE
);
SetEvent
(
start_event
);
while
((
ret
=
MsgWaitForMultipleObjectsEx
(
events_count
,
events
,
INFINITE
,
QS_ALLINPUT
,
0
))
<=
events_count
)
while
((
ret
=
MsgWaitForMultipleObjectsEx
(
state
.
events_count
,
state
.
events
,
INFINITE
,
QS_ALLINPUT
,
0
))
<=
state
.
events_count
)
{
UINT
kbd_cnt
=
0
,
mice_cnt
=
0
;
if
(
ret
<
events_count
)
if
(
ret
<
state
.
events_count
)
{
EnterCriticalSection
(
&
dinput_hook_crit
);
LIST_FOR_EACH_ENTRY_SAFE
(
impl
,
next
,
&
acquired_device_list
,
struct
dinput_device
,
entry
)
{
if
(
impl
->
read_event
==
events
[
ret
])
if
(
impl
->
read_event
==
state
.
events
[
ret
])
{
if
(
FAILED
(
impl
->
vtbl
->
read
(
&
impl
->
IDirectInputDevice8W_iface
)
))
{
...
...
@@ -314,18 +319,18 @@ static DWORD WINAPI dinput_thread_proc( void *params )
SetEvent
(
finished_event
);
}
events_count
=
0
;
state
.
events_count
=
0
;
EnterCriticalSection
(
&
dinput_hook_crit
);
LIST_FOR_EACH_ENTRY
(
impl
,
&
acquired_device_list
,
struct
dinput_device
,
entry
)
{
if
(
!
impl
->
read_event
||
!
impl
->
vtbl
->
read
)
continue
;
if
(
events_count
>=
ARRAY_SIZE
(
events
))
break
;
events
[
events_count
++
]
=
impl
->
read_event
;
if
(
state
.
events_count
>=
ARRAY_SIZE
(
state
.
events
))
break
;
state
.
events
[
state
.
events_count
++
]
=
impl
->
read_event
;
}
LeaveCriticalSection
(
&
dinput_hook_crit
);
}
if
(
ret
!=
events_count
)
ERR
(
"Unexpected termination, ret %#lx
\n
"
,
ret
);
if
(
ret
!=
state
.
events_count
)
ERR
(
"Unexpected termination, ret %#lx
\n
"
,
ret
);
done:
DestroyWindow
(
di_em_win
);
...
...
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