mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 21:17:54 +00:00
[c-host] mousehook: ignore repeated hook events
This commit is contained in:
parent
687eddcc63
commit
b4cf8f76c8
2 changed files with 9 additions and 3 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
B1-106-g9d6d137b50+1
|
||||
B1-107-g687eddcc63+1
|
|
@ -29,6 +29,7 @@ struct mouseHook
|
|||
bool installed;
|
||||
HHOOK hook;
|
||||
MouseHookFn callback;
|
||||
int x, y;
|
||||
};
|
||||
|
||||
static struct mouseHook mouseHook = { 0 };
|
||||
|
@ -92,7 +93,12 @@ static LRESULT WINAPI mouseHook_hook(int nCode, WPARAM wParam, LPARAM lParam)
|
|||
if (nCode == HC_ACTION && wParam == WM_MOUSEMOVE)
|
||||
{
|
||||
MSLLHOOKSTRUCT *msg = (MSLLHOOKSTRUCT *)lParam;
|
||||
mouseHook.callback(msg->pt.x, msg->pt.y);
|
||||
if (mouseHook.x != msg->pt.x || mouseHook.y != msg->pt.y)
|
||||
{
|
||||
mouseHook.x = msg->pt.x;
|
||||
mouseHook.y = msg->pt.y;
|
||||
mouseHook.callback(msg->pt.x, msg->pt.y);
|
||||
}
|
||||
}
|
||||
return CallNextHookEx(mouseHook.hook, nCode, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue