aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slock.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/slock.c b/slock.c
index 68e813f..d6053af 100644
--- a/slock.c
+++ b/slock.c
@@ -119,11 +119,12 @@ readpw(Display *dpy, const char *pws)
119{ 119{
120 char buf[32], passwd[256]; 120 char buf[32], passwd[256];
121 int num, screen; 121 int num, screen;
122 unsigned int len, llen; 122 unsigned int len, color;
123 KeySym ksym; 123 KeySym ksym;
124 XEvent ev; 124 XEvent ev;
125 static int oldc = INIT;
125 126
126 len = llen = 0; 127 len = 0;
127 running = True; 128 running = True;
128 129
129 /* As "slock" stands for "Simple X display locker", the DPMS settings 130 /* As "slock" stands for "Simple X display locker", the DPMS settings
@@ -174,18 +175,14 @@ readpw(Display *dpy, const char *pws)
174 } 175 }
175 break; 176 break;
176 } 177 }
177 if (llen == 0 && len != 0) { 178 color = len ? INPUT : (failure || failonclear ? FAILED : INIT);
179 if (oldc != color) {
178 for (screen = 0; screen < nscreens; screen++) { 180 for (screen = 0; screen < nscreens; screen++) {
179 XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[INPUT]); 181 XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[color]);
180 XClearWindow(dpy, locks[screen]->win);
181 }
182 } else if (llen != 0 && len == 0) {
183 for (screen = 0; screen < nscreens; screen++) {
184 XSetWindowBackground(dpy, locks[screen]->win, locks[screen]->colors[failure || failonclear ? FAILED : INIT]);
185 XClearWindow(dpy, locks[screen]->win); 182 XClearWindow(dpy, locks[screen]->win);
186 } 183 }
184 oldc = color;
187 } 185 }
188 llen = len;
189 } else if (rr && ev.type == rrevbase + RRScreenChangeNotify) { 186 } else if (rr && ev.type == rrevbase + RRScreenChangeNotify) {
190 XRRScreenChangeNotifyEvent *rre = (XRRScreenChangeNotifyEvent*)&ev; 187 XRRScreenChangeNotifyEvent *rre = (XRRScreenChangeNotifyEvent*)&ev;
191 for (screen = 0; screen < nscreens; screen++) { 188 for (screen = 0; screen < nscreens; screen++) {