commit 5fa767f5f20a025793d4968f9421e946c1612c4b
parent 370a6fe6e9c4fe8269c6f75a19c4d5159d7a51d6
Author: Louis Burda <quent.burda@gmail.com>
Date: Thu, 28 Sep 2023 02:15:31 +0200
Ignore initial control modifier keypresse
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -8,6 +8,9 @@ static const char *colorname[NUMCOLS] = {
[FAILED] = "#CC3333", /* wrong password */
};
+/* allow control key to trigger fail on clear */
+static const int controlkeyclear = 0;
+
/* treat a cleared input like a wrong password (color) */
static const int failonclear = 1;
diff --git a/slock.c b/slock.c
@@ -184,8 +184,9 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
passwd[--len] = '\0';
break;
default:
- if (num && !iscntrl((int)buf[0]) &&
- (len + num < sizeof(passwd))) {
+ if (controlkeyclear && iscntrl((int)buf[0]))
+ continue;
+ if (num && (len + num < sizeof(passwd))) {
memcpy(passwd + len, buf, num);
len += num;
}