From 9463684d550a05289c1a6d1e9a603fa28c7bccad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 8 Jun 2020 09:47:07 +0200 Subject: [PATCH] dinput: Stop sending WM_WINE_NOTIFY_ACTIVITY on every input. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Alexandre Julliard --- dlls/dinput/device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 8c5aa318837..51ae349f34e 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -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;