Mercurial > pidgin
changeset 4548:ae85f27e4948
[gaim-migrate @ 4827]
Idle time was incorrect, because we were getting Mouse
move messages despite the coords not having changed. There is
now a check to verify that the coords have changed.
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Fri, 07 Feb 2003 01:10:29 +0000 |
parents | 1f19b66c5d84 |
children | 1752173a71c5 |
files | src/win32/IdleTracker/idletrack.c |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/win32/IdleTracker/idletrack.c Fri Feb 07 01:08:25 2003 +0000 +++ b/src/win32/IdleTracker/idletrack.c Fri Feb 07 01:10:29 2003 +0000 @@ -10,11 +10,20 @@ #define EXPORT __declspec(dllexport) +/* from msdn docs */ +typedef struct tagMOUSEHOOKSTRUCT { + POINT pt; + HWND hwnd; + UINT wHitTestCode; + DWORD dwExtraInfo; +} MOUSEHOOKSTRUCT; + static HANDLE hMapObject = NULL; static DWORD *lastTime = NULL; static HHOOK keyHook = NULL; static HHOOK mouseHook = NULL; static HINSTANCE g_hInstance = NULL; +static POINT g_point; static DWORD* setup_shared_mem() { BOOL fInit; @@ -52,7 +61,6 @@ LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam) { if (code < 0) return CallNextHookEx(keyHook, code, wParam, lParam); - if (lastTime == NULL) lastTime = setup_shared_mem(); @@ -66,6 +74,14 @@ LRESULT CALLBACK MouseProc(int code, WPARAM wParam, LPARAM lParam) { if (code < 0) return CallNextHookEx(mouseHook, code, wParam, lParam); + + /* We need to verify that the Mouse pointer has actually moved. */ + if((g_point.x == ((MOUSEHOOKSTRUCT*)lParam)->pt.x) && + (g_point.y == ((MOUSEHOOKSTRUCT*)lParam)->pt.y)) + return 0; + + g_point.x = ((MOUSEHOOKSTRUCT*)lParam)->pt.x; + g_point.y = ((MOUSEHOOKSTRUCT*)lParam)->pt.y; if (lastTime == NULL) lastTime = setup_shared_mem(); @@ -131,6 +147,8 @@ switch(dwReason) { case DLL_PROCESS_ATTACH: g_hInstance = hInstance; + g_point.x = 0; + g_point.y = 0; break; case DLL_PROCESS_DETACH: break;