user32: Throttle device list updates from GetRawInputDeviceList.

Up to once every 2s.

This fixes a regression from c2c78a2fe0,
which caused severe FPS drop in Samurai Shodown.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51282
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-14 21:24:23 +01:00 committed by Alexandre Julliard
parent 6a30f12eef
commit a80f76819c
1 changed files with 7 additions and 2 deletions

View File

@ -418,7 +418,8 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
*/
UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_count, UINT size)
{
UINT i;
static UINT last_check;
UINT i, ticks = GetTickCount();
TRACE("devices %p, device_count %p, size %u.\n", devices, device_count, size);
@ -434,7 +435,11 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun
return ~0U;
}
rawinput_update_device_list();
if (ticks - last_check > 2000)
{
last_check = ticks;
rawinput_update_device_list();
}
if (!devices)
{