From 5e7e8958e5b1ebe42fcaad65ffd0e784dfb0b888 Mon Sep 17 00:00:00 2001 From: Igor Kolokolnikov Date: Wed, 2 Sep 2026 17:53:19 -0700 Subject: [PATCH] First press of ESC key clear the password, then offs display. --- slock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slock.c b/slock.c index 987b22b..7c396eb 100644 --- a/slock.c +++ b/slock.c @@ -239,7 +239,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, if(passing) continue; - if(ksym == XK_Escape) { + if(len == 0 && ksym == XK_Escape) { dspon = !is_screen_on(dpy); continue; } @@ -259,10 +259,10 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, explicit_bzero(&passwd, sizeof(passwd)); len = 0; break; - /*case XK_Escape: + case XK_Escape: explicit_bzero(&passwd, sizeof(passwd)); len = 0; - break;*/ + break; case XK_BackSpace: if (len) passwd[--len] = '\0';