From 04bb6dccb761875cb38e8a54c06eb1b4718291e3 Mon Sep 17 00:00:00 2001 From: veltza <106755522+veltza@users.noreply.github.com> Date: Mon, 1 Sep 2025 21:43:59 +0300 Subject: [PATCH] Prevent the control clear patch from blocking ctrl-u The control clear patch is not compatible with the latest ctrl-u feature because it blocks all ctrl shortcuts. This fix ensures that the patch is active only when the ctrl key is pressed without any other keys. Note that the patch is also active when the shift or alt key is pressed without any other keys. This is an undocumented feature of this patch and is caused by the iscntrl function, which returns true if the ascii value is zero. --- slock.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/slock.c b/slock.c index d270f8c03a64ab1dc6dad5f74ce4fbc0e45a5c53..72adfa5a4532df357a1c5d34bf269bc67a0811b1 100644 --- a/slock.c +++ b/slock.c @@ -393,13 +393,11 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, #endif // MEDIAKEYS_PATCH default: #if CONTROLCLEAR_PATCH - if (controlkeyclear && iscntrl((int)buf[0])) + if (controlkeyclear && iscntrl((int)buf[0]) && !num) continue; - if (num && (len + num < sizeof(passwd))) - #else + #endif // CONTROLCLEAR_PATCH if (num && !iscntrl((int)buf[0]) && (len + num < sizeof(passwd))) - #endif // CONTROLCLEAR_PATCH { memcpy(passwd + len, buf, num); len += num;