Introduction
Introduction Statistics Contact Development Disclaimer Help
slock-quickcancel-20160619-65b8d52.diff - sites - public wiki contents of suckl…
git clone git://git.suckless.org/sites
Log
Files
Refs
---
slock-quickcancel-20160619-65b8d52.diff (1553B)
---
1 diff --git a/config.def.h b/config.def.h
2 index eae2d9a..fbc8f13 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -6,3 +6,6 @@ static const char *colorname[NUMCOLS] = {
6
7 /* treat a cleared input like a wrong password */
8 static const int failonclear = 1;
9 +
10 +/* time to cancel lock with mouse movement in seconds */
11 +static const int timetocancel = 3;
12 diff --git a/slock.c b/slock.c
13 index c9cdee2..a187d7a 100644
14 --- a/slock.c
15 +++ b/slock.c
16 @@ -12,6 +12,7 @@
17 #include <stdio.h>
18 #include <string.h>
19 #include <unistd.h>
20 +#include <time.h>
21 #include <sys/types.h>
22 #include <X11/extensions/Xrandr.h>
23 #include <X11/keysym.h>
24 @@ -46,6 +47,7 @@ static Bool failure = False;
25 static Bool rr;
26 static int rrevbase;
27 static int rrerrbase;
28 +static time_t tim;
29
30 static void
31 die(const char *errstr, ...)
32 @@ -134,6 +136,7 @@ readpw(Display *dpy, const char *pws)
33 * utility. This way the user can easily set a customized DPMS
34 * timeout. */
35 while (running && !XNextEvent(dpy, &ev)) {
36 + running = !((time(NULL) - tim < timetocancel) && (ev.ty…
37 if (ev.type == KeyPress) {
38 buf[0] = 0;
39 num = XLookupString(&ev.xkey, buf, sizeof(buf),…
40 @@ -261,6 +264,7 @@ lockscreen(Display *dpy, int screen)
41 if (XGrabKeyboard(dpy, lock->root, True, GrabMo…
42 /* everything fine, we grabbed both inp…
43 XSelectInput(dpy, lock->root, Substruct…
44 + tim = time(NULL);
45 return lock;
46 }
47 usleep(1000);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.