forked from mirror/dwl
Merge pull request #54 from Bonicgamer/swayscalebox
Sway scale_box (rounding)
This commit is contained in:
commit
128c2926e1
1 changed files with 5 additions and 4 deletions
9
dwl.c
9
dwl.c
|
@ -53,6 +53,7 @@
|
||||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||||
#define END(A) ((A) + LENGTH(A))
|
#define END(A) ((A) + LENGTH(A))
|
||||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
|
#define ROUND(X) ((X)>=0?(long)((X)+0.5):(long)((X)-0.5))
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
#define WLR_SURFACE(C) ((C)->type != XDGShell ? (C)->surface.xwayland->surface : (C)->surface.xdg->surface)
|
#define WLR_SURFACE(C) ((C)->type != XDGShell ? (C)->surface.xwayland->surface : (C)->surface.xdg->surface)
|
||||||
#else
|
#else
|
||||||
|
@ -1804,10 +1805,10 @@ run(char *startup_cmd)
|
||||||
void
|
void
|
||||||
scalebox(struct wlr_box *box, float scale)
|
scalebox(struct wlr_box *box, float scale)
|
||||||
{
|
{
|
||||||
box->x *= scale;
|
box->width = ROUND((box->x + box->width) * scale) - ROUND(box->x * scale);
|
||||||
box->y *= scale;
|
box->height = ROUND((box->y + box->height) * scale) - ROUND(box->y * scale);
|
||||||
box->width *= scale;
|
box->x = ROUND(box->x * scale);
|
||||||
box->height *= scale;
|
box->y = ROUND(box->y * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
|
|
Loading…
Reference in a new issue