diff options
author | okan <okan> | 2017-05-05 14:14:19 +0000 |
---|---|---|
committer | okan <okan> | 2017-05-05 14:14:19 +0000 |
commit | 189a735eaa16a01b491518fc5db5183ef0c6d76b (patch) | |
tree | 439ead081ac47e4bac532711f66f9c253990b57f | |
parent | 3d6ff6dabfba7bb863970a7780c3e6ba19f06612 (diff) | |
download | cwm-189a735eaa16a01b491518fc5db5183ef0c6d76b.tar.gz cwm-189a735eaa16a01b491518fc5db5183ef0c6d76b.tar.xz cwm-189a735eaa16a01b491518fc5db5183ef0c6d76b.zip |
Ensure clients stay within the viewable bounds on placement, even with empty
borders; based on a patch from Vadim Vygonets.
-rw-r--r-- | client.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/client.c b/client.c index 72f0183..e7ab123 100644 --- a/client.c +++ b/client.c @@ -761,14 +761,14 @@ client_placecalc(struct client_ctx *cc) wmax = DisplayWidth(X_Dpy, sc->which); hmax = DisplayHeight(X_Dpy, sc->which); - if (cc->geom.x + (cc->bwidth * 2) >= wmax) - cc->geom.x = wmax - (cc->bwidth * 2); - if (cc->geom.x + cc->geom.w - (cc->bwidth * 2) < 0) - cc->geom.x = -cc->geom.w; - if (cc->geom.y + (cc->bwidth * 2) >= hmax) - cc->geom.y = hmax - (cc->bwidth * 2); - if (cc->geom.y + cc->geom.h - (cc->bwidth * 2) < 0) - cc->geom.y = -cc->geom.h; + if (cc->geom.x >= wmax) + cc->geom.x = wmax - cc->bwidth - 1; + if (cc->geom.x + cc->geom.w + cc->bwidth <= 0) + cc->geom.x = -(cc->geom.w + cc->bwidth - 1); + if (cc->geom.y >= hmax) + cc->geom.x = hmax - cc->bwidth - 1; + if (cc->geom.y + cc->geom.h + cc->bwidth <= 0) + cc->geom.y = -(cc->geom.h + cc->bwidth - 1); } else { struct geom area; int xmouse, ymouse; |