[lacros] Fix blurry Lacros window when display scale is fractional
This CL makes sure that LaCros windows receive big enough
wl_output.scale from exo when display scale is fractional by rounding it
up to the closest integer.
This is similar to how other compositors (Mutter, Sway) deal with
fractional scaling: clients are only aware of integer scaling and the
actual contents of windows are scaled down on the compositor side
(it's already done in Aura in our case).
Bug: 1093021
Change-Id: Ia47dd60dc0cb60396028c1ce108e095ecc84884f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404930
Reviewed-by: Mitsuru Oshima (Slow: gardener) <oshima@chromium.org>
Commit-Queue: Zakhar Voit <zvoit@igalia.com>
Cr-Commit-Position: refs/heads/master@{#806494}
diff --git a/components/exo/wayland/wayland_display_observer.cc b/components/exo/wayland/wayland_display_observer.cc
index 00fb373..aa9b2db5 100644
--- a/components/exo/wayland/wayland_display_observer.cc
+++ b/components/exo/wayland/wayland_display_observer.cc
@@ -115,11 +115,10 @@
if (wl_resource_get_version(output_resource_) >=
WL_OUTPUT_SCALE_SINCE_VERSION) {
- // Sending 100% if the scale is less then 100%, because wl_output_send_scale
- // doesn't support fractional scale.
- wl_output_send_scale(
- output_resource_,
- std::max(1, static_cast<int32_t>(display.device_scale_factor())));
+ // wl_output only supports integer scaling, so if device scale factor is
+ // fractional we need to round it up to the closest integer.
+ wl_output_send_scale(output_resource_,
+ std::ceil(display.device_scale_factor()));
}
// TODO(reveman): Send real list of modes.