diff src/idle.c @ 3905:3e508dd31b76

[gaim-migrate @ 4058] IdleTracker committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 05 Nov 2002 22:34:05 +0000
parents 6b0cb60162f4
children 511c2b63caa4
line wrap: on
line diff
--- a/src/idle.c	Tue Nov 05 22:32:59 2002 +0000
+++ b/src/idle.c	Tue Nov 05 22:34:05 2002 +0000
@@ -27,10 +27,14 @@
 #include <unistd.h>
 
 #ifdef USE_SCREENSAVER
+#ifndef _WIN32
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/extensions/scrnsaver.h>
 #include <gdk/gdkx.h>
+#else
+#include "IdleTracker.h"
+#endif
 #endif /* USE_SCREENSAVER */
 
 #include "multi.h"
@@ -43,8 +47,10 @@
 	struct gaim_connection *gc = data;
 	time_t t;
 #ifdef USE_SCREENSAVER
+#ifndef _WIN32
 	static XScreenSaverInfo *mit_info = NULL;
 #endif
+#endif
 	time_t idle_time;
 
 	/* Not idle, really...  :) */
@@ -57,6 +63,7 @@
 
 #ifdef USE_SCREENSAVER
 	if (report_idle == IDLE_SCREENSAVER) {
+#ifndef _WIN32
 		int event_base, error_base;
 		if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) {
 			if (mit_info == NULL) {
@@ -66,6 +73,10 @@
 			idle_time = (mit_info->idle) / 1000;
 		} else
 			idle_time = 0;
+#else
+		/* IdleTracker monitors usage of all other apps by setting a hook function */
+		idle_time = (GetTickCount() - IdleTrackerGetLastTickCount()) / 1000;
+#endif
 	} else
 #endif /* USE_SCREENSAVER */
 		idle_time = t - gc->lastsent;