From 19c43453659e7a31e78f36fe3191dea9a744c1b5 Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Wed, 13 Mar 2019 21:11:22 +0100 Subject: [PATCH] added quickcancel patch --- PKGBUILD | 18 +++++---- config.h | 3 ++ local-quickcancel-20160619-65b8d52.diff | 49 +++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 local-quickcancel-20160619-65b8d52.diff diff --git a/PKGBUILD b/PKGBUILD index 9a4216d..6ab51a7 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -10,14 +10,18 @@ license=('MIT') depends=('libxext' 'libxrandr') source=("http://dl.suckless.org/tools/$pkgname-$pkgver.tar.gz") #source=("slock-$pkgver.tar.bz2::http://hg.suckless.org/slock/archive/$_pkgver.tar.gz") -md5sums=('f91dd5ba50ce7bd1842caeca067086a3' - '76c1d90cfb0a1da62a00caec951f48f7' - '2afeace988ef4eaf0a8a078aded7c4a0') -sha256sums=('b53849dbc60109a987d7a49b8da197305c29307fd74c12dc18af0d3044392e6a' - '209c5e9954f38f6dae8cc32f7c79bc0351eee5210f943912d1ff0c7a305a355c' - '0d5508c24ab2e870f1d807044c08c7c4f835e696267ecca7521b08f59bc803d1') -_patches=("slock-dpms-20170923-fa11589.diff") +sha256sums=('b53849dbc60109a987d7a49b8da197305c29307fd74c12dc18af0d3044392e6a' + '97c09fd6f7e0aff3002a24dabe57798bcfaa1467a043cf7b7119177f005e5848' + '0d5508c24ab2e870f1d807044c08c7c4f835e696267ecca7521b08f59bc803d1' + 'e4f1401e0f6a2615e3c1a6ab204e84b83917388d77247c311bf7902f1245b373') + +_patches=("slock-dpms-20170923-fa11589.diff" + "local-quickcancel-20160619-65b8d52.diff" + #"slock-message-20180626-35633d4.diff" + #"slock-mediakeys-20170111-2d2a21a.diff" + #"slock-1.2-background-image.diff" + ) source=("http://dl.suckless.org/st/$pkgname-$pkgver.tar.gz" "config.h" diff --git a/config.h b/config.h index 1428bb0..a6306fb 100644 --- a/config.h +++ b/config.h @@ -13,3 +13,6 @@ static const int failonclear = 1; /* time in seconds before the monitor shuts down */ static const int monitortime = 5; + +/* time to cancel lock with mouse movement in seconds */ +static const int timetocancel = 3; diff --git a/local-quickcancel-20160619-65b8d52.diff b/local-quickcancel-20160619-65b8d52.diff new file mode 100644 index 0000000..9089a07 --- /dev/null +++ b/local-quickcancel-20160619-65b8d52.diff @@ -0,0 +1,49 @@ +diff -up a/config.def.h b/config.def.h +--- a/config.def.h ++++ b/config.def.h +@@ -13,3 +13,9 @@ static const int failonclear = 1; + + /* time in seconds before the monitor shuts down */ + static const int monitortime = 5; ++ ++/* treat a cleared input like a wrong password */ ++static const int failonclear = 1; ++ ++/* time to cancel lock with mouse movement in seconds */ ++static const int timetocancel = 3; +diff -up a/slock.c b/slock.c +--- a/slock.c ++++ b/slock.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -23,6 +24,8 @@ + #include "arg.h" + #include "util.h" + ++static time_t tim; ++ + char *argv0; + + enum { +@@ -142,6 +145,7 @@ readpw(Display *dpy, struct xrandr *rr, + oldc = INIT; + + while (running && !XNextEvent(dpy, &ev)) { ++ running = !((time(NULL) - tim < timetocancel) && (ev.type == MotionNotify)); + if (ev.type == KeyPress) { + explicit_bzero(&buf, sizeof(buf)); + num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0); +@@ -269,6 +273,7 @@ lockscreen(Display *dpy, struct xrandr * + XRRSelectInput(dpy, lock->win, RRScreenChangeNotifyMask); + + XSelectInput(dpy, lock->root, SubstructureNotifyMask); ++ tim = time(NULL); + return lock; + } +