diff options
author | Simon Rettberg | 2017-03-02 11:59:20 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-03-02 11:59:20 +0100 |
commit | 115f6979542d4d86385c9667518cf6f979b20bc0 (patch) | |
tree | fdfc5229155496f166fd294aea8026101f048b82 /core/modules/idleaction | |
parent | [beamergui] Don't use unreliable xargs, fix a little syntax error (diff) | |
download | mltk-115f6979542d4d86385c9667518cf6f979b20bc0.tar.gz mltk-115f6979542d4d86385c9667518cf6f979b20bc0.tar.xz mltk-115f6979542d4d86385c9667518cf6f979b20bc0.zip |
[idleaction] Patch xprintidle to not use the creepy workaround anymore
This used to work around a bug in the xserver where it would always
reset the idle time whenever the screen goes to standby or suspend.
This does not happen anymore on a recent system, so xprintidle would
erroneously add the timeout values to the idletime, resulting in
incorrect high results when the screen is turned off.
Diffstat (limited to 'core/modules/idleaction')
-rw-r--r-- | core/modules/idleaction/xprintidle.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/modules/idleaction/xprintidle.c b/core/modules/idleaction/xprintidle.c index 7fc62486..eae02988 100644 --- a/core/modules/idleaction/xprintidle.c +++ b/core/modules/idleaction/xprintidle.c @@ -40,7 +40,7 @@ unsigned long workaroundCreepyXServer(Display *dpy, unsigned long _idleTime ); int main(int argc, char *argv[]) { - XScreenSaverInfo ssi; + XScreenSaverInfo *ssi; Display *dpy; int event_basep, error_basep; @@ -60,13 +60,22 @@ int main(int argc, char *argv[]) return 1; } - if (!XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), &ssi)) { + ssi = XScreenSaverAllocInfo(); + if (ssi == NULL) { + fprintf(stderr, "couldn't allocate screen saver info\n"); + return 1; + } + + if (!XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), ssi)) { fprintf(stderr, "couldn't query screen saver info\n"); return 1; } - printf("%lu\n", workaroundCreepyXServer(dpy, ssi.idle)); + //printf("%lu\n", workaroundCreepyXServer(dpy, ssi.idle)); + // Apparently not needed anymore since some recent X11 release. + printf("%lu\n", dpy, ssi->idle); + XFree(ssi); XCloseDisplay(dpy); return 0; } |