Title: Improved Modifier Handling Author: Eric Pruitt (https://www.codevat.com/, https://github.com/ericpruitt/) With this patch, modifier keys only cause the screen to display the failure color when they are released without pressing a complementary key. This patch depends on "slock-00-pam-authentication.diff". --- a/slock.c +++ b/slock.c @@ -226,6 +226,7 @@ readpw(struct xrandr *rr, int nscreens, const char *hash) unsigned int len, color; KeySym ksym; XEvent ev; + int seenkeypress = 0; len = 0; running = 1; @@ -233,9 +234,14 @@ readpw(struct xrandr *rr, int nscreens, const char *hash) * utility. This way the user can easily set a customized DPMS * timeout. */ while (running && !XNextEvent(dpy, &ev)) { - if (ev.type == KeyPress) { + if (ev.type == KeyPress || ev.type == KeyRelease) { explicit_bzero(&buf, sizeof(buf)); num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0); + seenkeypress |= ev.type == KeyPress; + if ((ev.type == KeyRelease && (num || !seenkeypress)) || + (ev.type == KeyPress && !num)) { + continue; + } if (IsKeypadKey(ksym)) { if (ksym == XK_KP_Enter) ksym = XK_Return;