Reapply "respect size hints"

This reverts commit 31bf1cbaf6.

Fixes https://codeberg.org/dwl/dwl/issues/105
Fixes https://codeberg.org/dwl/dwl/issues/634
Fixes https://codeberg.org/dwl/dwl/issues/1171
This commit is contained in:
Guido Cella
2026-09-15 20:03:28 +02:00
parent 36c80aff03
commit 4de32d2d5c
2 changed files with 45 additions and 14 deletions
+13 -3
View File
@@ -3,6 +3,7 @@
*/
#include <getopt.h>
#include <libinput.h>
#include <limits.h>
#include <linux/input-event-codes.h>
#include <math.h>
#include <signal.h>
@@ -483,9 +484,18 @@ static struct wlr_xwayland *xwayland;
void
applybounds(Client *c, struct wlr_box *bbox)
{
/* set minimum possible */
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->isfullscreen) {
struct wlr_box min = {0}, max = {0};
client_get_size_hints(c, &max, &min);
c->geom.width = MAX(min.width + 2 * (int)c->bw, c->geom.width);
c->geom.height = MAX(min.height + 2 * (int)c->bw, c->geom.height);
/* Some clients set their max size to INT_MAX, which does not violate the
* protocol but it's unnecesary, as they can set their max size to zero. */
if (max.width && 2 * (int)c->bw <= INT_MAX - max.width) /* Checks for overflow */
c->geom.width = MIN(max.width + 2 * (int)c->bw, c->geom.width);
if (max.height && 2 * (int)c->bw <= INT_MAX - max.height) /* Checks for overflow */
c->geom.height = MIN(max.height + 2 * (int)c->bw, c->geom.height);
}
if (c->geom.x >= bbox->x + bbox->width)
c->geom.x = bbox->x + bbox->width - c->geom.width;