From 134756388105672448c444adb8991077fc0d12b9 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sun, 16 Jan 2022 13:20:35 +0100 Subject: Apply quickcancel patch --- slock.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'slock.c') diff --git a/slock.c b/slock.c index 6ec145f..c273e62 100644 --- a/slock.c +++ b/slock.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #ifdef XINERAMA @@ -30,6 +31,8 @@ char *argv0; +static time_t locktime; + enum { BACKGROUND, INIT, @@ -179,6 +182,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, oldc = INIT; while (running && !XNextEvent(dpy, &ev)) { + running = !((time(NULL) - locktime < timetocancel) && (ev.type == MotionNotify)); if (ev.type == KeyPress) { explicit_bzero(&buf, sizeof(buf)); num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0); @@ -337,6 +341,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) XRRSelectInput(dpy, lock->win, RRScreenChangeNotifyMask); XSelectInput(dpy, lock->root, SubstructureNotifyMask); + locktime = time(NULL); drawlogo(dpy, lock, INIT); return lock; } -- cgit v1.2.3-70-g09d2