aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorkrypek <115574014+krypciak@users.noreply.github.com>2022-11-23 22:56:52 +0100
committerLeonardo Hernández <leohdz172@protonmail.com>2022-11-25 12:09:35 -0600
commit87d87cc4041a997d00ebf234ca5118b9248a3b95 (patch)
treef0211aa94ebed3f4dfd8ab3e9e19ad083838a7de /dwl.c
parent569f55401693c9d2850f056f20ca2bd5bd5977fd (diff)
Fix comparison between signed and unsigned int
When c->bw is 0, the right side of the MAX functions gets turned into an unsigned integer and that results in -1 being the outcome. This causes big issues in xwayland clients.
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dwl.c b/dwl.c
index b884d06..fc6c4da 100644
--- a/dwl.c
+++ b/dwl.c
@@ -389,8 +389,8 @@ applybounds(Client *c, struct wlr_box *bbox)
struct wlr_box min = {0}, max = {0};
client_get_size_hints(c, &max, &min);
/* try to set size hints */
- c->geom.width = MAX(min.width + (2 * c->bw), c->geom.width);
- c->geom.height = MAX(min.height + (2 * c->bw), c->geom.height);
+ 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 them max size to INT_MAX, which does not violates
* the protocol but its innecesary, they can set them max size to zero. */
if (max.width > 0 && !(2 * c->bw > INT_MAX - max.width)) /* Checks for overflow */