From 26a3c64dcf825ff604044958781cb9553f897515 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Tue, 7 May 2024 19:59:14 +0200 Subject: [PATCH] Make sure whole client is inside of bounds in applybounds --- dwl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 752e66d..d9880d7 100644 --- a/dwl.c +++ b/dwl.c @@ -432,14 +432,19 @@ applybounds(Client *c, struct wlr_box *bbox) c->geom.width = MAX(1 + 2 * (int)c->bw, c->geom.width); c->geom.height = MAX(1 + 2 * (int)c->bw, c->geom.height); + printf("Current pos: %d,%d, %dx%d\n", c->geom.x, c->geom.y, c->geom.width, c->geom.height); + printf("Applying bounds: %d,%d, %dx%d\n", bbox->x, bbox->y, bbox->width, bbox->height); + if (c->geom.x >= bbox->x + bbox->width) c->geom.x = bbox->x + bbox->width - c->geom.width; if (c->geom.y >= bbox->y + bbox->height) c->geom.y = bbox->y + bbox->height - c->geom.height; - if (c->geom.x + c->geom.width + 2 * (int)c->bw <= bbox->x) + if (c->geom.x < bbox->x) c->geom.x = bbox->x; - if (c->geom.y + c->geom.height + 2 * (int)c->bw <= bbox->y) + if (c->geom.y < bbox->y) c->geom.y = bbox->y; + + printf("Updated pos: %d,%d, %dx%d\n", c->geom.x, c->geom.y, c->geom.width, c->geom.height); } void -- 2.48.1