commit e917ce30b75a8aa961ebb11d828084ebbec24820
parent e3ec5b4820e96888cee941ad53aabc058eb6d0ec
Author: David Phillips <dbphillipsnz@gmail.com>
Date: Fri, 29 Apr 2016 11:01:42 +1200
[slock] add patch for ignoring control keys
Diffstat:
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/tools.suckless.org/slock/patches/control-clear.md 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 - <dbphillipsnz@gmail.com>
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
@@ -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;
+ }