Comment 13 for bug 1194568

Revision history for this message
In , Jeff (jeff-redhat-bugs) wrote :

I also tried running this little C program below to print the X server idle time. I was curious if the idle time was increasing even though I was typing.

It's odd, but the idle time appears to be staying quite low:

$ while : ; do echo "$(date) : $(./xprintidle)"; sleep 10 ; done
...
Thu Feb 7 13:28:59 CST 2013 : 1310
Thu Feb 7 13:29:09 CST 2013 : 7
Thu Feb 7 13:29:19 CST 2013 : 6711
Thu Feb 7 13:29:29 CST 2013 : 911
...

The screensaver kicked in at 13:29:08 even though the idle time was no more than 11.3 seconds, and my xscreensaver timeout is at 60 seconds (normally it's 5 minutes, but I reduced it to 1 minute for debugging).

http://stackoverflow.com/questions/11887679/how-does-x11-xscreensaver-know-how-long-ive-been-idle-xprintidle-unhelpful

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <X11/extensions/scrnsaver.h>
#include <stdio.h>

int main() {
    Display *display = XOpenDisplay(0);
    if (display != 0) {
      XScreenSaverInfo *info = XScreenSaverAllocInfo();
      XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
      if (info)
      {
        printf("%lu\n", info->idle);
        XFree(info);
        return 0;
      }
      return -1;
    }
    return -1;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~