changeset 17073:2d6aed3e7c2e

Part of a patch from: http://www.linuxpowertop.org/known.php#gaim " ...will also ask the X server every 5 seconds if the X server supports the X screensaver extension.... the X server either supports or doesn't support this, this isn't changing after starting the application."
author Richard Laager <rlaager@wiktel.com>
date Mon, 14 May 2007 03:05:27 +0000
parents 10c7c5d4ea25
children e8c3b6da7f18
files pidgin/gtkidle.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkidle.c	Sun May 13 10:26:08 2007 +0000
+++ b/pidgin/gtkidle.c	Mon May 14 03:05:27 2007 +0000
@@ -103,14 +103,21 @@
 
 	/* Query xscreensaver */
 	static XScreenSaverInfo *mit_info = NULL;
+	static int has_extension = -1;
 	int event_base, error_base;
-	if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) {
-		if (mit_info == NULL) {
+
+	if (has_extension == -1)
+		has_extension = XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base);
+
+	if (has_extension)
+	{
+		if (mit_info == NULL)
 			mit_info = XScreenSaverAllocInfo();
-		}
+
 		XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info);
 		return (mit_info->idle) / 1000;
-	} else
+	}
+	else
 		return 0;
 #  endif /* !_WIN32 */
 # endif /* !HAVE_IOKIT */