diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-06-26 15:32:01 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-06-29 13:38:23 +0000 |
| commit | 8ccabb79745f079417b3a049f52c4779d6efdf07 (patch) | |
| tree | df60044cab8b9f2190173c823c136e2998d70ab0 | |
| parent | wayland: initialize window scale to -1 (diff) | |
wayland: surface_scale(): implement fractional scaling
This is done by setting the surface’s viewport destination
| -rw-r--r-- | wayland.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1889,11 +1889,20 @@ wayl_surface_scale_explicit_width_height( const struct wayland *wayl, const struct wayl_surface *surf, int width, int height, float scale) { - LOG_WARN("scaling by a factor of %.2f (legacy)", scale); if (wayl_fractional_scaling(wayl)) { - BUG("not yet implemented"); +#if defined(HAVE_FRACTIONAL_SCALE) + LOG_DBG("scaling by a factor of %.2f (fractional scaling)", scale); + wp_viewport_set_destination( + surf->viewport, + round((float)width / scale), + round((float)height / scale)); +#else + BUG("wayl_fraction_scaling() returned true, " + "but fractional scaling was not available at compile time"). +#endif } else { + LOG_DBG("scaling by a factor of %.2f (legacy)", scale); wl_surface_set_buffer_scale(surf->surf, (int)scale); } } |
