diff options
author | rmax <rmax> | 2005-06-01 16:36:29 (GMT) |
---|---|---|
committer | rmax <rmax> | 2005-06-01 16:36:29 (GMT) |
commit | 5268b0f34fe8eb4558b6ce4a25911b8af24514cd (patch) | |
tree | 691d6c36a6a8e4ca0d0d0a3940eb8ad25c37343b | |
parent | 652ef5183729dd32b6b98921b3f464e05553db78 (diff) | |
download | tk-5268b0f34fe8eb4558b6ce4a25911b8af24514cd.zip tk-5268b0f34fe8eb4558b6ce4a25911b8af24514cd.tar.gz tk-5268b0f34fe8eb4558b6ce4a25911b8af24514cd.tar.bz2 |
Some versions of X seem to crash if XScreenSaverQueryVersion() isn't
called before calling XScreenSaverQueryInfo().
-rw-r--r-- | unix/tkUnix.c | 11 |
1 files 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 <tkInt.h> @@ -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); |