dinput: Stop sending WM_WINE_NOTIFY_ACTIVITY on every input.

This message triggers screensaver notification in the user drivers, but
it is not useful to send it on every input message, and it even hurts
performance when high polling mouse is used.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33643
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46976
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 2020-06-08 09:47:07 +02:00 committed by Alexandre Julliard
parent f2e886a006
commit 9463684d55
1 changed files with 7 additions and 1 deletions

View File

@ -931,13 +931,19 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
void queue_event(LPDIRECTINPUTDEVICE8A iface, int inst_id, DWORD data, DWORD time, DWORD seq)
{
static ULONGLONG notify_ms = 0;
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8A(iface);
int next_pos, ofs = id_to_offset(&This->data_format, inst_id);
ULONGLONG time_ms = GetTickCount64();
/* Event is being set regardless of the queue state */
if (This->hEvent) SetEvent(This->hEvent);
PostMessageW(GetDesktopWindow(), WM_WINE_NOTIFY_ACTIVITY, 0, 0);
if (time_ms - notify_ms > 1000)
{
PostMessageW(GetDesktopWindow(), WM_WINE_NOTIFY_ACTIVITY, 0, 0);
notify_ms = time_ms;
}
if (!This->queue_len || This->overflow || ofs < 0) return;