comparison src/win32/IdleTracker/idletrack.c @ 6561:33ceba0dfd9b

[gaim-migrate @ 7083] Fix for bug #792641 - Windows hooks tie up committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Thu, 21 Aug 2003 18:29:48 +0000
parents 5480a73b2696
children 59ffe137176d
comparison
equal deleted inserted replaced
6560:aeb5ee62debc 6561:33ceba0dfd9b
57 return lastTime; 57 return lastTime;
58 } 58 }
59 59
60 60
61 LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam) { 61 LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam) {
62 if (code < 0) 62 if (!(code < 0)) {
63 return CallNextHookEx(keyHook, code, wParam, lParam); 63 if (lastTime == NULL)
64 if (lastTime == NULL) 64 lastTime = setup_shared_mem();
65 lastTime = setup_shared_mem();
66 65
67 if (lastTime) 66 if (lastTime)
68 *lastTime = GetTickCount(); 67 *lastTime = GetTickCount();
69 68 }
70 return CallNextHookEx(keyHook, code, wParam, lParam); 69 return CallNextHookEx(keyHook, code, wParam, lParam);
71 } 70 }
72 71
73 72
74 LRESULT CALLBACK MouseProc(int code, WPARAM wParam, LPARAM lParam) { 73 LRESULT CALLBACK MouseProc(int code, WPARAM wParam, LPARAM lParam) {
75 if (code < 0)
76 return CallNextHookEx(mouseHook, code, wParam, lParam);
77
78 /* We need to verify that the Mouse pointer has actually moved. */ 74 /* We need to verify that the Mouse pointer has actually moved. */
79 if((g_point.x == ((MOUSEHOOKSTRUCT*)lParam)->pt.x) && 75 if(!(code < 0) &&
80 (g_point.y == ((MOUSEHOOKSTRUCT*)lParam)->pt.y)) 76 !((g_point.x == ((MOUSEHOOKSTRUCT*)lParam)->pt.x) &&
81 return 0; 77 (g_point.y == ((MOUSEHOOKSTRUCT*)lParam)->pt.y))) {
82 78 g_point.x = ((MOUSEHOOKSTRUCT*)lParam)->pt.x;
83 g_point.x = ((MOUSEHOOKSTRUCT*)lParam)->pt.x; 79 g_point.y = ((MOUSEHOOKSTRUCT*)lParam)->pt.y;
84 g_point.y = ((MOUSEHOOKSTRUCT*)lParam)->pt.y;
85 80
86 if (lastTime == NULL) 81 if (lastTime == NULL)
87 lastTime = setup_shared_mem(); 82 lastTime = setup_shared_mem();
88 83
89 if (lastTime) 84 if (lastTime)
90 *lastTime = GetTickCount(); 85 *lastTime = GetTickCount();
91 86 }
92 return CallNextHookEx(mouseHook, code, wParam, lParam); 87 return CallNextHookEx(mouseHook, code, wParam, lParam);
93 } 88 }
94 89
95 90
96 EXPORT DWORD wgaim_get_lastactive() { 91 EXPORT DWORD wgaim_get_lastactive() {