{
char buf[32], passwd[256];
int num, screen;
- unsigned int len, llen;
+ unsigned int len, color;
KeySym ksym;
XEvent ev;
+ static int oldc = INIT;
- len = llen = 0;
+ len = 0;
running = True;
/* As "slock" stands for "Simple X display locker", the DPMS settings
}
break;
}
- if (llen == 0 && len != 0) {
+ color = len ? INPUT : (failure || failonclear ? FAILED : INIT);
+ if (oldc != color) {
for (screen = 0; screen < nscreens; screen++) {
- XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[INPUT]);
- XClearWindow(dpy, locks[screen]->win);
- }
- } else if (llen != 0 && len == 0) {
- for (screen = 0; screen < nscreens; screen++) {
- XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[failure || failonclear ? FAILED : INIT]);
+ XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[color]);
XClearWindow(dpy, locks[screen]->win);
}
+ oldc = color;
}
- llen = len;
} else if (rr && ev.type == rrevbase + RRScreenChangeNotify) {
XRRScreenChangeNotifyEvent *rre = (XRRScreenChangeNotifyEvent*)&ev;
for (screen = 0; screen < nscreens; screen++) {