aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorokan2017-05-05 14:14:19 +0000
committerokan2017-05-05 14:14:19 +0000
commitc44f7f8975b29c13365cb80c54a9b7f26fee3943 (patch)
tree82adb115e870252bc741b86c5ad65a2910f248da /client.c
parenta43d7fb97d3e0d9463b75b78595ccf0eececa007 (diff)
downloadcwm-c44f7f8975b29c13365cb80c54a9b7f26fee3943.tar.gz
Ensure clients stay within the viewable bounds on placement, even with empty
borders; based on a patch from Vadim Vygonets.
Diffstat (limited to 'client.c')
-rw-r--r--client.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/client.c b/client.c
index f6f3d33..a163f4f 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.239 2017/05/01 12:54:55 okan Exp $
+ * $OpenBSD: client.c,v 1.240 2017/05/05 14:14:19 okan Exp $
*/
#include <sys/types.h>
@@ -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;