comparison src/idle.c @ 2115:3ce77b547cf2

[gaim-migrate @ 2125] idle stuff. does this look odd to you? committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 03 Aug 2001 10:17:06 +0000
parents c582116e8463
children bd9d403fb15b
comparison
equal deleted inserted replaced
2114:c582116e8463 2115:3ce77b547cf2
28 28
29 #ifdef USE_SCREENSAVER 29 #ifdef USE_SCREENSAVER
30 #include <X11/Xlib.h> 30 #include <X11/Xlib.h>
31 #include <X11/Xutil.h> 31 #include <X11/Xutil.h>
32 #include <X11/extensions/scrnsaver.h> 32 #include <X11/extensions/scrnsaver.h>
33 #include <gdk/gdkx.h>
33 #endif /* USE_SCREENSAVER */ 34 #endif /* USE_SCREENSAVER */
34 35
35 #include "multi.h" 36 #include "multi.h"
36 #include "gaim.h" 37 #include "gaim.h"
37 #include "prpl.h" 38 #include "prpl.h"
40 gint check_idle(struct gaim_connection *gc) 41 gint check_idle(struct gaim_connection *gc)
41 { 42 {
42 time_t t; 43 time_t t;
43 #ifdef USE_SCREENSAVER 44 #ifdef USE_SCREENSAVER
44 static XScreenSaverInfo *mit_info = NULL; 45 static XScreenSaverInfo *mit_info = NULL;
45 static Display *d = NULL;
46 #endif 46 #endif
47 time_t idle_time; 47 time_t idle_time;
48 48
49 /* Not idle, really... :) */ 49 /* Not idle, really... :) */
50 update_idle_times(); 50 update_idle_times();
54 time(&t); 54 time(&t);
55 55
56 56
57 #ifdef USE_SCREENSAVER 57 #ifdef USE_SCREENSAVER
58 if (report_idle == IDLE_SCREENSAVER) { 58 if (report_idle == IDLE_SCREENSAVER) {
59 if (d || (d = XOpenDisplay((char *)NULL))) { 59 int event_base, error_base;
60 if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) {
60 if (mit_info == NULL) { 61 if (mit_info == NULL) {
61 mit_info = XScreenSaverAllocInfo(); 62 mit_info = XScreenSaverAllocInfo();
62 } 63 }
63 XScreenSaverQueryInfo(d, DefaultRootWindow(d), mit_info); 64 XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info);
64 idle_time = (mit_info->idle) / 1000; 65 idle_time = (mit_info->idle) / 1000;
65 } else 66 } else
66 idle_time = 0; 67 idle_time = 0;
67 } else 68 } else
68 #endif /* USE_SCREENSAVER */ 69 #endif /* USE_SCREENSAVER */