mirror of
https://github.com/alrayyes/slock
synced 2023-11-13 18:16:41 +00:00
added quickcancel patch
This commit is contained in:
parent
2f8a36efc6
commit
19c4345365
18
PKGBUILD
18
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"
|
||||
|
3
config.h
3
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;
|
||||
|
49
local-quickcancel-20160619-65b8d52.diff
Normal file
49
local-quickcancel-20160619-65b8d52.diff
Normal file
@ -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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include <X11/extensions/dpms.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user