[NTUSER] Avoid sending superfluous WM_MOUSEMOVE messages (#6397)

Add a check so that mouse move messages are not generated unless
the mouse cursor X or Y position is changed.

This fixes extra mouse moves generated when clicking.
Patch by I_Kill_Bugs.

CORE-8394 CORE-18529 CORE-19422 CORE-19423
This commit is contained in:
Doug Lyons 2024-04-12 15:58:52 -05:00 committed by GitHub
parent 31ce37da2a
commit 76290a6696
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -264,13 +264,15 @@ BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Ho
pt.x = x;
pt.y = y;
/* 1. Generate a mouse move message, this sets the htEx and Track Window too. */
Msg.message = WM_MOUSEMOVE;
Msg.wParam = UserGetMouseButtonsState();
Msg.lParam = MAKELPARAM(x, y);
Msg.pt = pt;
co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook);
if ((gpsi->ptCursor.x != x) || (gpsi->ptCursor.y != y))
{
/* 1. Generate a mouse move message, this sets the htEx and Track Window too. */
Msg.message = WM_MOUSEMOVE;
Msg.wParam = UserGetMouseButtonsState();
Msg.lParam = MAKELPARAM(x, y);
Msg.pt = pt;
co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook);
}
/* 2. Store the new cursor position */
gpsi->ptCursor = pt;