[hackers] [slock] Fix resize with multiple monitors and portrait mode || Bob Uhl

From: <git_AT_suckless.org>
Date: Wed, 23 Nov 2016 00:30:02 +0100 (CET)

commit 7a604ec1fae1eda36f210a28a2cf466583a9cb87
Author: Bob Uhl <buhl_AT_zvelo.com>
AuthorDate: Mon Nov 7 10:15:20 2016 -0700
Commit: Markus Teich <teichm_AT_fs.tum.de>
CommitDate: Wed Nov 23 00:26:51 2016 +0100

    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.

diff --git a/slock.c b/slock.c
index d2f0886..61fe9ee 100644
--- a/slock.c
+++ b/slock.c
_AT_@ -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);
                                 }
                         }
Received on Wed Nov 23 2016 - 00:30:02 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 23 2016 - 00:36:15 CET