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 /slock.c | |
parent | 4ed35d22dcd68bc926cdd0f2f93ab24ea3a66a02 (diff) | |
download | slock-049ccf9a906dd9d4b261d3e9bb4166eaadb62731.tar.gz slock-049ccf9a906dd9d4b261d3e9bb4166eaadb62731.tar.xz |
fixed DPMS crashing issue
Diffstat (limited to 'slock.c')
-rw-r--r-- | slock.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,4 @@ -/* © 2006-2008 Anselm R Garbe <garbeam at gmail dot com> - * See LICENSE file for license details. */ +/* See LICENSE file for license details. */ #define _XOPEN_SOURCE 500 #if HAVE_SHADOW_H #include <shadow.h> @@ -126,11 +125,16 @@ main(int argc, char **argv) { /* main event loop */ while(running && !XNextEvent(dpy, &ev)) { - if(len == 0) + if(len == 0 && DPMSCapable(dpy)) DPMSForceLevel(dpy, DPMSModeOff); if(ev.type == KeyPress) { buf[0] = 0; num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0); + if(IsKeypadKey(ksym)) + if(ksym == XK_KP_Enter) + ksym = XK_Return; + else if(ksym >= XK_KP_0 && ksym <= XK_KP_9) + ksym = (ksym - XK_KP_0) + XK_0; if(IsFunctionKey(ksym) || IsKeypadKey(ksym) || IsMiscFunctionKey(ksym) || IsPFKey(ksym) || IsPrivateKeypadKey(ksym)) |