diff options
author | Bob Uhl <buhl@zvelo.com> | 2016-11-07 10:15:20 -0700 |
---|---|---|
committer | Markus Teich <teichm@fs.tum.de> | 2016-11-23 00:26:51 +0100 |
commit | 7a604ec1fae1eda36f210a28a2cf466583a9cb87 (patch) | |
tree | 1dd4997fb189f8fe58789a0b927e6108de173632 /slock.c | |
parent | fa1158958466f38cd35c9114023a0175e67ebb6f (diff) |
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 (limited to 'slock.c')
-rw-r--r-- | slock.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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); } } |