summaryrefslogtreecommitdiff
path: root/slock/slock.c
diff options
context:
space:
mode:
Diffstat (limited to 'slock/slock.c')
-rw-r--r--slock/slock.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/slock/slock.c b/slock/slock.c
index 2ecc59d..962cc1d 100644
--- a/slock/slock.c
+++ b/slock/slock.c
@@ -129,13 +129,17 @@ drawlogo(Display *dpy, struct lock *lock, const char *col)
XftColor xftc;
XGlyphInfo ext;
int i, x, y, w, h, lines = 0, maxw = 0, lineh;
+ size_t len;
w = DisplayWidth(dpy, lock->screen);
h = DisplayHeight(dpy, lock->screen);
lineh = font->ascent + font->descent;
for (i = 0; icon[i]; i++) {
- XftTextExtentsUtf8(dpy, font, (FcChar8 *)icon[i], strlen(icon[i]), &ext);
+ len = strlen(icon[i]);
+ while (len && icon[i][len - 1] == ' ')
+ len--;
+ XftTextExtentsUtf8(dpy, font, (FcChar8 *)icon[i], len, &ext);
if (ext.xOff > maxw)
maxw = ext.xOff;
lines++;
@@ -149,8 +153,11 @@ drawlogo(Display *dpy, struct lock *lock, const char *col)
XClearWindow(dpy, lock->win);
for (i = 0; icon[i]; i++) {
+ len = strlen(icon[i]);
+ while (len && icon[i][len - 1] == ' ')
+ len--;
XftDrawStringUtf8(lock->draw, &xftc, font, x, y,
- (FcChar8 *)icon[i], strlen(icon[i]));
+ (FcChar8 *)icon[i], len);
y += lineh;
}
@@ -292,7 +299,8 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
pfd.events = POLLIN;
while (running) {
- if (poll(&pfd, 1, 1000) > 0) {
+ /* poll at ~60Hz so accent gradients appear smooth */
+ if (poll(&pfd, 1, 5) > 0) {
while (XPending(dpy)) {
XNextEvent(dpy, &ev);
if (ev.type == KeyPress) {