aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h1
-rw-r--r--slock.c9
2 files changed, 7 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h
index 4bccb5d..fca0ae0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,3 +3,4 @@ static const char *colorname[NUMCOLS] = {
3 "#005577", /* during input */ 3 "#005577", /* during input */
4 "#CC3333", /* failed/cleared the input */ 4 "#CC3333", /* failed/cleared the input */
5}; 5};
6static const Bool failonclear = True;
diff --git a/slock.c b/slock.c
index 6502c86..1551a9e 100644
--- a/slock.c
+++ b/slock.c
@@ -26,7 +26,7 @@
26enum { 26enum {
27 INIT, 27 INIT,
28 INPUT, 28 INPUT,
29 EMPTY, 29 FAILED,
30 NUMCOLS 30 NUMCOLS
31}; 31};
32 32
@@ -42,6 +42,7 @@ typedef struct {
42static Lock **locks; 42static Lock **locks;
43static int nscreens; 43static int nscreens;
44static Bool running = True; 44static Bool running = True;
45static Bool failure = False;
45static Bool rr; 46static Bool rr;
46static int rrevbase; 47static int rrevbase;
47static int rrerrbase; 48static int rrerrbase;
@@ -153,8 +154,10 @@ readpw(Display *dpy, const char *pws)
153#else 154#else
154 running = !!strcmp(crypt(passwd, pws), pws); 155 running = !!strcmp(crypt(passwd, pws), pws);
155#endif 156#endif
156 if (running) 157 if (running) {
157 XBell(dpy, 100); 158 XBell(dpy, 100);
159 failure = True;
160 }
158 len = 0; 161 len = 0;
159 break; 162 break;
160 case XK_Escape: 163 case XK_Escape:
@@ -178,7 +181,7 @@ readpw(Display *dpy, const char *pws)
178 } 181 }
179 } else if (llen != 0 && len == 0) { 182 } else if (llen != 0 && len == 0) {
180 for (screen = 0; screen < nscreens; screen++) { 183 for (screen = 0; screen < nscreens; screen++) {
181 XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[EMPTY]); 184 XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[failure || failonclear ? FAILED : INIT]);
182 XClearWindow(dpy, locks[screen]->win); 185 XClearWindow(dpy, locks[screen]->win);
183 } 186 }
184 } 187 }