commit e917ce30b75a8aa961ebb11d828084ebbec24820
Author: David Phillips <[email protected]>
Date: Fri Apr 29 11:01:42 2016 +1200
[slock] add patch for ignoring control keys
diff --git a/tools.suckless.org/slock/patches/control-clear.md
b/tools.suckless.org/slock/patches/control-clear.md
new file mode 100644
index 0000000..26cf69e
--- /dev/null
+++ b/tools.suckless.org/slock/patches/control-clear.md
@@ -0,0 +1,20 @@
+Control Clear
+=============
+
+Description
+-----------
+Adds an additional configuration parameter, controlkeyclear. When set to 1,
+slock will no longer change to the failure color if a control key is pressed
+while the buffer is empty. This is useful if, for example, you wake your
+monitor up by pressing a control key and don't want to spoil the detection of
+failed unlocking attempts.
+
+Download
+--------
+
+*
[slock-git-20160406-control-clear.diff](slock-git-20160406-control-clear.diff)
+
+Author
+------
+
+* David Phillips - <[email protected]>
diff --git
a/tools.suckless.org/slock/patches/slock-git-20160406-control-clear.diff
b/tools.suckless.org/slock/patches/slock-git-20160406-control-clear.diff
new file mode 100644
index 0000000..248dc87
--- /dev/null
+++ b/tools.suckless.org/slock/patches/slock-git-20160406-control-clear.diff
@@ -0,0 +1,26 @@
+diff --git a/config.def.h b/config.def.h
+index eae2d9a..c81908a 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -6,3 +6,6 @@ static const char *colorname[NUMCOLS] = {
+
+ /* treat a cleared input like a wrong password */
+ static const int failonclear = 1;
++
++/* allow control key to trigger fail on clear */
++static const int controlkeyclear = 0;
+diff --git a/slock.c b/slock.c
+index c9cdee2..43f6e97 100644
+--- a/slock.c
++++ b/slock.c
+@@ -171,7 +171,9 @@ readpw(Display *dpy, const char *pws)
+ --len;
+ 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;
+ }