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>
This commit is contained in:
Rémi Bernon 2021-12-22 14:46:15 +01:00 committed by Alexandre Julliard
parent a7f0647dec
commit ac442a78a1
1 changed files with 12 additions and 7 deletions

View File

@ -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;