comparison src/idle.c @ 1027:a375efb2884e

[gaim-migrate @ 1037] bmiller is a big ol dummy. Yeah thats right, you herd me! :-D Actually, bro, you opened the X Display but never closed it. Sooo, unfortunately, after a certain amount of time you're no longer able to open any X Applications. This should fix it :) Cheers, Rob committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 26 Oct 2000 11:45:56 +0000
parents 5bad25457843
children e4147c8604cc
comparison
equal deleted inserted replaced
1026:5bad25457843 1027:a375efb2884e
40 gint check_idle(struct gaim_connection *gc) 40 gint check_idle(struct gaim_connection *gc)
41 { 41 {
42 time_t t; 42 time_t t;
43 #ifdef USE_SCREENSAVER 43 #ifdef USE_SCREENSAVER
44 static XScreenSaverInfo *mit_info = NULL; 44 static XScreenSaverInfo *mit_info = NULL;
45 Display *d = XOpenDisplay((char*)NULL); 45 Display *d;
46 time_t idle_time; 46 time_t idle_time;
47 #endif 47 #endif
48 48
49 /* Not idle, really... :) */ 49 /* Not idle, really... :) */
50 update_all_buddies(); 50 update_all_buddies();
62 } 62 }
63 */ 63 */
64 64
65 #ifdef USE_SCREENSAVER 65 #ifdef USE_SCREENSAVER
66 if (report_idle == IDLE_SCREENSAVER) { 66 if (report_idle == IDLE_SCREENSAVER) {
67 d = XOpenDisplay((char *)NULL);
67 if (mit_info == NULL) { 68 if (mit_info == NULL) {
68 mit_info = XScreenSaverAllocInfo (); 69 mit_info = XScreenSaverAllocInfo ();
69 } 70 }
70 XScreenSaverQueryInfo (d, DefaultRootWindow(d), mit_info); 71 XScreenSaverQueryInfo (d, DefaultRootWindow(d), mit_info);
71 idle_time = (mit_info->idle)/1000; 72 idle_time = (mit_info->idle)/1000;
73 XCloseDisplay(d);
72 } else 74 } else
73 #endif /* USE_SCREENSAVER */ 75 #endif /* USE_SCREENSAVER */
74 idle_time = t - gc->lastsent; 76 idle_time = t - gc->lastsent;
75 77
76 if (idle_time > 600) { /* 10 minutes! */ 78 if (idle_time > 600) { /* 10 minutes! */