diff options
author | Anselm R Garbe <garbeam@gmail.com> | 2008-04-08 09:55:46 +0100 |
---|---|---|
committer | Anselm R Garbe <garbeam@gmail.com> | 2008-04-08 09:55:46 +0100 |
commit | 049ccf9a906dd9d4b261d3e9bb4166eaadb62731 (patch) | |
tree | f5ea6cd03d557b4acd25aaf84c4863ab0be2d8d6 | |
parent | 4ed35d22dcd68bc926cdd0f2f93ab24ea3a66a02 (diff) |
fixed DPMS crashing issue
-rw-r--r-- | config.mk | 2 | ||||
-rw-r--r-- | slock.c | 10 |
2 files changed, 8 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | # slock version | 1 | # slock version |
2 | VERSION = 0.8 | 2 | VERSION = 0.9 |
3 | 3 | ||
4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
5 | 5 | ||
@@ -1,5 +1,4 @@ | |||
1 | /* © 2006-2008 Anselm R Garbe <garbeam at gmail dot com> | 1 | /* See LICENSE file for license details. */ |
2 | * See LICENSE file for license details. */ | ||
3 | #define _XOPEN_SOURCE 500 | 2 | #define _XOPEN_SOURCE 500 |
4 | #if HAVE_SHADOW_H | 3 | #if HAVE_SHADOW_H |
5 | #include <shadow.h> | 4 | #include <shadow.h> |
@@ -126,11 +125,16 @@ main(int argc, char **argv) { | |||
126 | 125 | ||
127 | /* main event loop */ | 126 | /* main event loop */ |
128 | while(running && !XNextEvent(dpy, &ev)) { | 127 | while(running && !XNextEvent(dpy, &ev)) { |
129 | if(len == 0) | 128 | if(len == 0 && DPMSCapable(dpy)) |
130 | DPMSForceLevel(dpy, DPMSModeOff); | 129 | DPMSForceLevel(dpy, DPMSModeOff); |
131 | if(ev.type == KeyPress) { | 130 | if(ev.type == KeyPress) { |
132 | buf[0] = 0; | 131 | buf[0] = 0; |
133 | num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0); | 132 | num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0); |
133 | if(IsKeypadKey(ksym)) | ||
134 | if(ksym == XK_KP_Enter) | ||
135 | ksym = XK_Return; | ||
136 | else if(ksym >= XK_KP_0 && ksym <= XK_KP_9) | ||
137 | ksym = (ksym - XK_KP_0) + XK_0; | ||
134 | if(IsFunctionKey(ksym) || IsKeypadKey(ksym) | 138 | if(IsFunctionKey(ksym) || IsKeypadKey(ksym) |
135 | || IsMiscFunctionKey(ksym) || IsPFKey(ksym) | 139 | || IsMiscFunctionKey(ksym) || IsPFKey(ksym) |
136 | || IsPrivateKeypadKey(ksym)) | 140 | || IsPrivateKeypadKey(ksym)) |