Module: wine Branch: master Commit: 9463684d550a05289c1a6d1e9a603fa28c7bccad URL: https://source.winehq.org/git/wine.git/?a=commit;h=9463684d550a05289c1a6d1e9...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Jun 8 09:47:07 2020 +0200
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
---
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 8c5aa31883..51ae349f34 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;