Hi, > I pushed a changeset into hg tip of slock which attempts to fix > the DPMS issue without using a separate error handler, hence > please recheck, If the crash still occurs, there is no other > choice than wether not supporting DPMS or implementing an error > handler which ignores BadMatch errors due to DPMSForceLevel > calls.
Kind of weird: DPMSForceLevel now neither crashes nor switches off the monitor, instead it displays the root window with a large X logo superimposed. Anyway, enabling DPMS without restoring its disabled status later seems a bit harsh, if it worked. How about adding a DPMS configuration variable and a note to the README? (Something like the attached patch.) This would also be nice for those who have DPMS enabled, but prefer it to be used based on timeout and not immediately when locking the terminal. Regards, Peter
diff -dpruN slock~/config.h slock/config.h --- slock~/config.h 1970-01-01 01:00:00.000000000 +0100 +++ slock/config.h 2008-04-10 06:41:24.000000000 +0200 @@ -0,0 +1 @@ +#define DPMS False diff -dpruN slock~/slock.c slock/slock.c --- slock~/slock.c 2008-04-10 06:52:22.000000000 +0200 +++ slock/slock.c 2008-04-10 05:24:24.000000000 +0200 @@ -22,6 +22,8 @@ #include <bsd_auth.h> #endif +#include "config.h" + void eprint(const char *errstr, ...) { va_list ap; @@ -125,10 +127,8 @@ main(int argc, char **argv) { /* main event loop */ while(running && !XNextEvent(dpy, &ev)) { - if(len == 0 && DPMSCapable(dpy)) { - DPMSEnable(dpy); + if(DPMS && len == 0) DPMSForceLevel(dpy, DPMSModeOff); - } if(ev.type == KeyPress) { buf[0] = 0; num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0);