add proper def check. check all f keys.

This commit is contained in:
Christopher Jeffrey 2014-08-06 10:16:33 -07:00
parent 77d8085ed1
commit cea569bdb4

10
slock.c
View File

@ -190,6 +190,7 @@ readpw(Display *dpy, const char *pws)
if(len) if(len)
--len; --len;
break; break;
#if SLOCK_SHUTDOWN
case XK_Alt_L: case XK_Alt_L:
case XK_Alt_R: case XK_Alt_R:
case XK_Control_L: case XK_Control_L:
@ -200,12 +201,19 @@ readpw(Display *dpy, const char *pws)
case XK_F4: case XK_F4:
case XK_F5: case XK_F5:
case XK_F6: case XK_F6:
case XK_F7: { case XK_F7:
case XK_F8:
case XK_F9:
case XK_F10:
case XK_F11:
case XK_F12:
case XK_F13: {
// Needs sudo privileges for systemctl // Needs sudo privileges for systemctl
char *args[] = { "sudo", "systemctl", "poweroff", NULL }; char *args[] = { "sudo", "systemctl", "poweroff", NULL };
execvp("sudo", args); execvp("sudo", args);
// fall-through if we fail // fall-through if we fail
} }
#endif
default: default:
if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) { if(num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) {
memcpy(passwd + len, buf, num); memcpy(passwd + len, buf, num);