X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=slock.c;h=5ae738c15d10d308c7f37c122a861f48d1d317e1;hb=8f3a5883fa89433551cf0107aa847b8e5be39300;hp=ad539dc123c169e46a43322104fd38cee0d14b48;hpb=597469541c10fdb8920ed190b72763b0719e5cb5;p=slock.git diff --git a/slock.c b/slock.c index ad539dc..5ae738c 100644 --- a/slock.c +++ b/slock.c @@ -31,8 +31,6 @@ enum { NUMCOLS }; -#include "config.h" - struct lock { int screen; Window root, win; @@ -46,6 +44,8 @@ struct xrandr { int errbase; }; +#include "config.h" + static void die(const char *errstr, ...) { @@ -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); + } } }