diff options
| author | Devin J. Pohly <djpohly@gmail.com> | 2020-12-24 21:36:38 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-24 21:36:38 -0500 | 
| commit | 128c2926e1d9bd3d0e530f0aa215d24b33b47552 (patch) | |
| tree | 31b38de3311ef67c588d199457a9baebb1b050a8 /dwl.c | |
| parent | c5087d413fb3e6feccf1116a2e9cad8e21b06975 (diff) | |
| parent | 4915214e47d8f9233bfe4446a223300908455865 (diff) | |
Merge pull request #54 from Bonicgamer/swayscalebox
Sway scale_box (rounding)
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 9 | 
1 files changed, 5 insertions, 4 deletions
| @@ -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 * | 
