# HG changeset patch # User Herman Bloggs # Date 1044580229 0 # Node ID ae85f27e49484c98ec94ac04bb49b37aee53bb5f # Parent 1f19b66c5d846e9405adfaab17493f2cc7daf8dd [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 diff -r 1f19b66c5d84 -r ae85f27e4948 src/win32/IdleTracker/idletrack.c --- 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;