slock

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 04bb6dccb761875cb38e8a54c06eb1b4718291e3
parent 06e06a1507143728cf3909a23191d423331e64a4
Author: veltza <106755522+veltza@users.noreply.github.com>
Date:   Mon,  1 Sep 2025 21:43:59 +0300

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.

Diffstat:
Mslock.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 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;