slock

simple X display locker utility

git clone https://9o.is/git/slock.git

commit c593d9e44d5a05743d1367fa88e3e2bc2907076d
parent ff84d38d4b270513b7a47a65f8d92376265d7cee
Author: Bob Uhl <buhl@zvelo.com>
Date:   Mon,  7 Nov 2016 10:15:20 -0700

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.

Diffstat:
Mslock.c | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/slock.c b/slock.c @@ -201,8 +201,13 @@ 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); } }