From 5268b0f34fe8eb4558b6ce4a25911b8af24514cd Mon Sep 17 00:00:00 2001 From: rmax Date: Wed, 1 Jun 2005 16:36:29 +0000 Subject: Some versions of X seem to crash if XScreenSaverQueryVersion() isn't called before calling XScreenSaverQueryInfo(). --- unix/tkUnix.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/unix/tkUnix.c b/unix/tkUnix.c index c0e454d..b4d2d67 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnix.c,v 1.7 2005/05/27 23:14:29 dkf Exp $ + * RCS: @(#) $Id: tkUnix.c,v 1.8 2005/06/01 16:36:29 rmax Exp $ */ #include @@ -194,12 +194,13 @@ Tk_GetUserInactiveTime(dpy) { long inactiveTime = -1; #ifdef HAVE_XSS - int eventBase; - int errorBase; + int eventBase, errorBase, major, minor; - if (XScreenSaverQueryExtension(dpy, &eventBase, &errorBase)) { + if (XScreenSaverQueryExtension(dpy, &eventBase, &errorBase) && + XScreenSaverQueryVersion(dpy, &major, &minor) && + major == 1 && minor == 0 ) { + XScreenSaverInfo *info = XScreenSaverAllocInfo(); - XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info); inactiveTime = info->idle; XFree(info); -- cgit v0.12