[hackers] [slock] applied Ali Gholami Rudi's patch regarding DPMS timeout customization and persistence || a

From: <hg_AT_suckless.org>
Date: Fri, 12 Dec 2008 19:35:57 +0000 (UTC)

changeset: 40:297116d7e65a
tag: tip
user: a_AT_null
date: Fri Dec 12 19:34:43 2008 +0000
files: config.mk slock.c
description:
applied Ali Gholami Rudi's patch regarding DPMS timeout customization and persistence

diff -r c3826943408d -r 297116d7e65a config.mk
--- a/config.mk Tue Jul 29 19:23:21 2008 +0100
+++ b/config.mk Fri Dec 12 19:34:43 2008 +0000
@@ -1,5 +1,5 @@
 # slock version
-VERSION = 0.9
+VERSION = 1.0
 
 # Customize below to fit your system
 
diff -r c3826943408d -r 297116d7e65a slock.c
--- a/slock.c Tue Jul 29 19:23:21 2008 +0100
+++ b/slock.c Fri Dec 12 19:34:43 2008 +0000
@@ -79,6 +79,7 @@
         XColor black, dummy;
         XEvent ev;
         XSetWindowAttributes wa;
+ CARD16 standby, suspend, off;
 
         if((argc == 2) && !strcmp("-v", argv[1]))
                 die("slock-"VERSION", © 2006-2008 Anselm R Garbe\n");
@@ -123,12 +124,13 @@
         len = 0;
         XSync(dpy, False);
 
+ if(DPMSCapable(dpy)) { /* save and customize DPMS settings */
+ DPMSGetTimeouts(dpy, &standby, &suspend, &off);
+ DPMSSetTimeouts(dpy, 10, 30, 90);
+ }
+
         /* main event loop */
         while(running && !XNextEvent(dpy, &ev)) {
- if(len == 0 && DPMSCapable(dpy)) {
- DPMSEnable(dpy);
- DPMSForceLevel(dpy, DPMSModeOff);
- }
                 if(ev.type == KeyPress) {
                         buf[0] = 0;
                         num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0);
@@ -170,6 +172,9 @@
                         }
                 }
         }
+ if(DPMSCapable(dpy)) { /* restore DPMS settings */
+ DPMSSetTimeouts(dpy, standby, suspend, off);
+ }
         XUngrabPointer(dpy, CurrentTime);
         XFreePixmap(dpy, pmap);
         XDestroyWindow(dpy, w);
Received on Fri Dec 12 2008 - 19:35:57 UTC

This archive was generated by hypermail 2.2.0 : Fri Dec 12 2008 - 19:36:04 UTC