Module: wine Branch: master Commit: ac442a78a1d50fc4f04529e64e5f0debc8df5fb9 URL: https://source.winehq.org/git/wine.git/?a=commit;h=ac442a78a1d50fc4f04529e64...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Dec 22 14:46:15 2021 +0100
dinput: Update internal thread events list on every wake up.
Instead of message notifications only. We have to remove the events from devices that are automatically unacquired whenever a read failed.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dinput/dinput_main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index cab8886f9db..a62d4d2ea3d 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1311,16 +1311,9 @@ static DWORD WINAPI dinput_thread_proc( void *params ) goto done; }
- events_count = 0; EnterCriticalSection( &dinput_hook_crit ); kbd_cnt = list_count( &acquired_keyboard_list ); mice_cnt = list_count( &acquired_mouse_list ); - 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; - } LeaveCriticalSection( &dinput_hook_crit );
if (kbd_cnt && !kbd_hook) @@ -1341,8 +1334,20 @@ static DWORD WINAPI dinput_thread_proc( void *params )
SetEvent(finished_event); } + + 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; + } + LeaveCriticalSection( &dinput_hook_crit ); }
+ if (ret != events_count) ERR("Unexpected termination, ret %#x\n", ret); + done: DestroyWindow( di_em_win ); di_em_win = NULL;