aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/dwl.c b/dwl.c
index 1639a1e..ed4325d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -53,6 +53,7 @@
#define LENGTH(X) (sizeof X / sizeof X[0])
#define END(A) ((A) + LENGTH(A))
#define TAGMASK ((1 << LENGTH(tags)) - 1)
+#define ROUND(X) ((X)>=0?(long)((X)+0.5):(long)((X)-0.5))
#ifdef XWAYLAND
#define WLR_SURFACE(C) ((C)->type != XDGShell ? (C)->surface.xwayland->surface : (C)->surface.xdg->surface)
#else
@@ -1804,10 +1805,10 @@ run(char *startup_cmd)
void
scalebox(struct wlr_box *box, float scale)
{
- box->x *= scale;
- box->y *= scale;
- box->width *= scale;
- box->height *= scale;
+ box->width = ROUND((box->x + box->width) * scale) - ROUND(box->x * scale);
+ box->height = ROUND((box->y + box->height) * scale) - ROUND(box->y * scale);
+ box->x = ROUND(box->x * scale);
+ box->y = ROUND(box->y * scale);
}
Client *