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.
This commit is contained in:
parent
fa11589584
commit
7a604ec1fa
1 changed files with 7 additions and 2 deletions
9
slock.c
9
slock.c
|
@ -201,8 +201,13 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
|
||||||
rre = (XRRScreenChangeNotifyEvent*)&ev;
|
rre = (XRRScreenChangeNotifyEvent*)&ev;
|
||||||
for (screen = 0; screen < nscreens; screen++) {
|
for (screen = 0; screen < nscreens; screen++) {
|
||||||
if (locks[screen]->win == rre->window) {
|
if (locks[screen]->win == rre->window) {
|
||||||
XResizeWindow(dpy, locks[screen]->win,
|
if (rre->rotation == RR_Rotate_90 ||
|
||||||
rre->width, rre->height);
|
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);
|
XClearWindow(dpy, locks[screen]->win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue