diff --git slock.c slock.c index a00fbb9..f24fd21 100644 --- slock.c +++ slock.c @@ -127,6 +127,7 @@ readpw(Display *dpy, const char *pws) KeySym ksym; XEvent ev; static int oldc = INIT; + int seenkeypress = 0; len = 0; running = True; @@ -136,9 +137,14 @@ readpw(Display *dpy, const char *pws) * 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;