From 8c5a66db15f76c0fe156d4b2fc7c00f636092f20 Mon Sep 17 00:00:00 2001 From: davidpkj Date: Sat, 28 May 2022 22:02:45 +0200 Subject: slock dwm logo --- slock.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'slock.c') diff --git a/slock.c b/slock.c index efbe833..23f89e6 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 { INIT, INPUT, @@ -183,6 +186,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); @@ -353,6 +357,7 @@ lockscreen(Display *dpy, struct xrandr *rr, int screen) XSelectInput(dpy, lock->root, SubstructureNotifyMask); drawlogo(dpy, lock, INIT); + locktime = time(NULL); return lock; } -- cgit v1.2.3