Make sure whole client is fully inside bounds

If possible, the client should get inside bounds completely,
not just overlap them as the behavior till now suggested.

Applybounds should put the windows inside the monitor bounds,
even over layer shell applications such as bars.
This commit is contained in:
Rutherther 2024-05-08 10:23:29 +02:00
parent 577d8da6d1
commit b4042ace34

10
dwl.c
View File

@ -432,13 +432,13 @@ 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);
if (c->geom.x >= bbox->x + bbox->width)
if (c->geom.x + c->geom.width >= bbox->x + bbox->width)
c->geom.x = bbox->x + bbox->width - c->geom.width;
if (c->geom.y >= bbox->y + bbox->height)
if (c->geom.y + c->geom.height >= 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;
}
@ -2034,7 +2034,7 @@ requestmonstate(struct wl_listener *listener, void *data)
void
resize(Client *c, struct wlr_box geo, int interact)
{
struct wlr_box *bbox = interact ? &sgeom : &c->mon->w;
struct wlr_box *bbox = interact ? &sgeom : &c->mon->m;
struct wlr_box clip;
client_set_bounds(c, geo.width, geo.height);
c->geom = geo;