Mercurial > pidgin
changeset 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 | 98ede8f38be6 |
children | eb1d58c2d6af |
files | Makefile.mingw config.h.mingw src/Makefile.mingw src/idle.c src/prefs.c src/win32/win32dep.c |
diffstat | 6 files changed, 33 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.mingw Tue Nov 05 22:32:59 2002 +0000 +++ b/Makefile.mingw Tue Nov 05 22:34:05 2002 +0000 @@ -13,6 +13,7 @@ GTK_TOP = ../win32-dev/gtk_2_0 GTK_LIBS = $(GTK_TOP)/lib PERL_TOP = ../win32-dev/perl56 +IDLETRACKER_TOP = $(GAIM_SRC)/win32/IdleTracker OSCAR = $(GAIM_PROTOS)/oscar YAHOO = $(GAIM_PROTOS)/yahoo MSN = $(GAIM_PROTOS)/msn @@ -41,6 +42,7 @@ $(GTK_LIBS)/libpangowin32-1.0-0.dll \ $(GTK_LIBS)/libatk-1.0-0.dll \ $(PERL_TOP)/perl56.dll \ + $(IDLETRACKER_TOP)/IdleTrac.dll # For Gtk 2.0.3 # $(GTK_LIBS)/libjpeg6b.dll \
--- a/config.h.mingw Tue Nov 05 22:32:59 2002 +0000 +++ b/config.h.mingw Tue Nov 05 22:34:05 2002 +0000 @@ -73,7 +73,7 @@ /* #undef USE_APPLET */ /* #undef USE_GNOME */ /* #undef USE_PIXBUF */ -/* #undef USE_SCREENSAVER */ +#define USE_SCREENSAVER 1 /* #undef NO_MULTI */ /* #define DEBUG 1 */ #define GAIM_PLUGINS 1
--- a/src/Makefile.mingw Tue Nov 05 22:32:59 2002 +0000 +++ b/src/Makefile.mingw Tue Nov 05 22:34:05 2002 +0000 @@ -16,6 +16,7 @@ PERL_INCLUDE := $(PERL_LIB_DIR)/CORE ASPELL_TOP := ../../win32-dev/aspell-15 GTKSPELL_TOP := ../../win32-dev/gtkspell-2.0.2 +IDLETRACKER_TOP := $(GAIM_TOP)/src/win32/IdleTracker GAIM_INSTALL_DIR := $(GAIM_TOP)/win32-install-dir ## @@ -47,6 +48,7 @@ INCLUDE_PATHS = -I$(INCLUDE_DIR) \ -I$(INCLUDE_DIR)/win32 \ + -I$(IDLETRACKER_TOP) \ -I$(GAIM_TOP) \ -I$(GTK_TOP)/include \ -I$(GTK_TOP)/include/gtk-2.0 \ @@ -62,6 +64,7 @@ LIB_PATHS = -L$(GTK_TOP)/lib \ -L$(GAIM_SRC) \ + -L$(IDLETRACKER_TOP) \ -L$(PERL_LIB_DIR) \ -L$(ASPELL_TOP)/lib \ -L$(GTKSPELL_TOP)/gtkspell @@ -120,7 +123,7 @@ ## LIBRARIES ## -DLL_LIBS = -lgtkspell \ +DLL_LIBS = -lgtkspell \ -lgtk-win32-2.0 \ -lpango-1.0 \ -lglib-2.0 \ @@ -133,7 +136,9 @@ -liberty \ -lwinmm \ -lperl56 \ - -laspell-15 + -laspell-15 \ + -lIdleTrac + EXE_LIBS = -lgaim -lglib-2.0 @@ -165,6 +170,8 @@ install: cp $(GAIM_SRC)/gaim.exe $(GAIM_SRC)/gaim.dll $(GAIM_INSTALL_DIR) +$(GAIM_SRC)/win32/IdleTracker/IdleTrac.dll: + $(MAKE) -C $(GAIM_SRC)/win32/IdleTracker -f Makefile.mingw # # BUILD DLL @@ -182,7 +189,7 @@ dlltool --dllname $(TARGET).dll --base-file $(TARGET).base \ --output-exp $(TARGET).exp --def $(TARGET).def -$(TARGET).dll: $(HEADER_DEPS) $(DLL_OBJECTS) $(TARGET).exp +$(TARGET).dll: $(HEADER_DEPS) $(DLL_OBJECTS) $(GAIM_SRC)/win32/IdleTracker/IdleTrac.dll $(TARGET).exp $(CC) -mdll $(LDFLAGS) -o $(TARGET).dll $(DLL_OBJECTS) -Wl,$(TARGET).exp $(LIB_PATHS) $(DLL_LIBS) rm -rf $(TARGET).exp $(TARGET).def $(TARGET).base @@ -202,6 +209,7 @@ clean: $(MAKE) -C $(GAIM_TOP)/sounds -f Makefile.mingw clean + $(MAKE) -C $(GAIM_SRC)/win32/IdleTracker -f Makefile.mingw clean rm -rf *.o ./win32/*.o rm -rf $(TARGET).dll rm -rf $(TARGET).lib
--- 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;
--- a/src/prefs.c Tue Nov 05 22:32:59 2002 +0000 +++ b/src/prefs.c Tue Nov 05 22:34:05 2002 +0000 @@ -743,7 +743,11 @@ "None", IDLE_NONE, "Gaim Usage", IDLE_GAIM, #ifdef USE_SCREENSAVER +#ifndef _WIN32 "X Usage", IDLE_SCREENSAVER, +#else + "Windows Usage", IDLE_SCREENSAVER, +#endif #endif NULL); gtk_size_group_add_widget(sg, dd);
--- a/src/win32/win32dep.c Tue Nov 05 22:32:59 2002 +0000 +++ b/src/win32/win32dep.c Tue Nov 05 22:34:05 2002 +0000 @@ -164,6 +164,10 @@ if(putenv(newenv)<0) debug_printf("putenv failed\n"); g_free(locale); + + /* IdleTracker Initialization */ + if(!IdleTrackerInit()) + debug_printf("IdleTracker failed to initialize\n"); } BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) {