enum {
INIT,
INPUT,
- EMPTY,
+ FAILED,
NUMCOLS
};
static Lock **locks;
static int nscreens;
static Bool running = True;
+static Bool failure = False;
static Bool rr;
static int rrevbase;
static int rrerrbase;
while (running && !XNextEvent(dpy, &ev)) {
if (ev.type == KeyPress) {
buf[0] = 0;
- num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0);
+ num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0);
if (IsKeypadKey(ksym)) {
if (ksym == XK_KP_Enter)
ksym = XK_Return;
#else
running = !!strcmp(crypt(passwd, pws), pws);
#endif
- if (running)
+ if (running) {
XBell(dpy, 100);
+ failure = True;
+ }
len = 0;
break;
case XK_Escape:
--len;
break;
default:
- if (num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) {
+ if (num && !iscntrl((int) buf[0]) && (len + num < sizeof(passwd))) {
memcpy(passwd + len, buf, num);
len += num;
}
}
} else if (llen != 0 && len == 0) {
for (screen = 0; screen < nscreens; screen++) {
- XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[EMPTY]);
+ XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[failure || failonclear ? FAILED : INIT]);
XClearWindow(dpy, locks[screen]->win);
}
}