aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-07-28 13:28:10 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-07-28 14:03:13 +0000
commit17824744812c16560dd214b98f28977b0d2fb47d (patch)
tree443a8cdff4bb847fc03a74cfc3d2a9bdd38dcddb /wayland.c
parentrender: round scaled border/title/button widths (diff)
fractional scaling: another round(!) of rounding fixes
* Ensure buffer sizes are valid. That is, ensure that size / scale * scale == size. * Do size calculation of the window geometry in the same way we calculate the CSD offsets.
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/wayland.c b/wayland.c
index 9a6609f4..66e06c10 100644
--- a/wayland.c
+++ b/wayland.c
@@ -2010,11 +2010,12 @@ wayl_surface_scale_explicit_width_height(
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
"(width=%d, height=%d) ", scale, width, height);
+ xassert((int)roundf(scale * (int)roundf(width / scale)) == width);
+ xassert((int)roundf(scale * (int)roundf(height / scale)) == height);
+
wl_surface_set_buffer_scale(surf->surf, 1);
wp_viewport_set_destination(
- surf->viewport,
- (int32_t)roundf((float)width / scale),
- (int32_t)roundf((float)height / scale));
+ surf->viewport, roundf(width / scale), roundf(height / scale));
#else
BUG("wayl_fraction_scaling() returned true, "
"but fractional scaling was not available at compile time");