changeset 1028:e4147c8604cc

[gaim-migrate @ 1038] This is a little more efficient. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 26 Oct 2000 11:48:42 +0000
parents a375efb2884e
children 740c6f933fe0
files src/idle.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/idle.c	Thu Oct 26 11:45:56 2000 +0000
+++ b/src/idle.c	Thu Oct 26 11:48:42 2000 +0000
@@ -42,7 +42,7 @@
 	time_t t;
 #ifdef USE_SCREENSAVER
 	static XScreenSaverInfo *mit_info = NULL;
-	Display *d;
+	static Display *d = NULL;
 	time_t idle_time;
 #endif
 
@@ -64,13 +64,13 @@
 
 #ifdef USE_SCREENSAVER
 	if (report_idle == IDLE_SCREENSAVER) {
-		d = XOpenDisplay((char *)NULL);
+		if (!d)
+			d = XOpenDisplay((char *)NULL);
 		if (mit_info == NULL) {
 			mit_info = XScreenSaverAllocInfo ();
 		}
 		XScreenSaverQueryInfo (d, DefaultRootWindow(d), mit_info);
 		idle_time = (mit_info->idle)/1000;
-		XCloseDisplay(d);
 	} else
 #endif /* USE_SCREENSAVER */
 		idle_time = t - gc->lastsent;