Compare commits

...

10 Commits

Author SHA1 Message Date
Hiltjo Posthuma 4f045545a2 bump version to 1.5 2022-10-04 19:45:14 +02:00
Hiltjo Posthuma 265704d736 Makefile: explicit_bzero.c was copied twice (GNU make gives a warning) 2022-10-04 19:44:47 +02:00
Tobias Stoeckmann 35633d4567 Properly clear the last entered character
When enter is pressed, passwd[len] will be set to '\0'. Pressing
backspace is supposed to remove the last entered character.

But currently, the clearing has an off-by-one, as in setting
passwd[len] to '\0' just like enter would do.

You can also verify it by imagining len=1 and that it's impossible to
clear passwd[0] by pressing backspace with the current code.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-03-25 21:51:29 +01:00
Markus Teich 2d2a21a90a rm trailing whitespace in README 2016-11-23 00:29:18 +01:00
Markus Teich 325581b935 syntax fix 2016-11-23 00:28:43 +01:00
Markus Teich 0ff0d9f7a7 there can only be one window in the event 2016-11-23 00:28:25 +01:00
Bob Uhl 7a604ec1fa Fix resize with multiple monitors and portrait mode
When connecting/disconnecting a portrait monitor, the
XRRScreenChangeNotifyEvent height & width are reversed due to the XRandR
rotation; detect this and DTRT.
2016-11-23 00:26:51 +01:00
Markus Teich fa11589584 bump version 2016-11-20 01:07:11 +01:00
Markus Teich d5da84cf5a add arg.h and util.h to Makefile 2016-11-20 01:01:47 +01:00
Markus Teich ae96836f90 clarify colors in config.def.h 2016-11-20 00:29:41 +01:00
5 changed files with 22 additions and 14 deletions

View File

@ -18,7 +18,7 @@ options:
@echo CC $<
@${CC} -c ${CFLAGS} $<
${OBJ}: config.h config.mk
${OBJ}: config.h config.mk arg.h util.h
config.h:
@echo creating $@ from config.def.h
@ -35,8 +35,8 @@ clean:
dist: clean
@echo creating dist tarball
@mkdir -p slock-${VERSION}
@cp -R LICENSE Makefile README config.def.h config.mk ${SRC} \
explicit_bzero.c slock.1 slock-${VERSION}
@cp -R LICENSE Makefile README slock.1 config.mk \
${SRC} config.def.h arg.h util.h slock-${VERSION}
@tar -cf slock-${VERSION}.tar slock-${VERSION}
@gzip slock-${VERSION}.tar
@rm -rf slock-${VERSION}

2
README
View File

@ -1,6 +1,6 @@
slock - simple screen locker
============================
simple screen locker utility for X.
simple screen locker utility for X.
Requirements

View File

@ -3,10 +3,10 @@ static const char *user = "nobody";
static const char *group = "nogroup";
static const char *colorname[NUMCOLS] = {
"black", /* after initialization */
"#005577", /* during input */
"#CC3333", /* wrong password */
[INIT] = "black", /* after initialization */
[INPUT] = "#005577", /* during input */
[FAILED] = "#CC3333", /* wrong password */
};
/* treat a cleared input like a wrong password */
/* treat a cleared input like a wrong password (color) */
static const int failonclear = 1;

View File

@ -1,5 +1,5 @@
# slock version
VERSION = 1.3
VERSION = 1.5
# Customize below to fit your system

18
slock.c
View File

@ -177,7 +177,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
break;
case XK_BackSpace:
if (len)
passwd[len--] = '\0';
passwd[--len] = '\0';
break;
default:
if (num && !iscntrl((int)buf[0]) &&
@ -201,13 +201,21 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
rre = (XRRScreenChangeNotifyEvent*)&ev;
for (screen = 0; screen < nscreens; screen++) {
if (locks[screen]->win == rre->window) {
XResizeWindow(dpy, locks[screen]->win,
rre->width, rre->height);
if (rre->rotation == RR_Rotate_90 ||
rre->rotation == RR_Rotate_270)
XResizeWindow(dpy, locks[screen]->win,
rre->height, rre->width);
else
XResizeWindow(dpy, locks[screen]->win,
rre->width, rre->height);
XClearWindow(dpy, locks[screen]->win);
break;
}
}
} else for (screen = 0; screen < nscreens; screen++)
XRaiseWindow(dpy, locks[screen]->win);
} else {
for (screen = 0; screen < nscreens; screen++)
XRaiseWindow(dpy, locks[screen]->win);
}
}
}