From b2a29280cbd3fcd825123e7636d511a06b2df242 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 17 Jul 2023 16:19:14 +0200 Subject: wayland: use physical DPI on fractional-scale capable compositors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With legacy scaling, we need to use a "scaled", or "logical" DPI value, that is basically the real DPI value scaled by the monitor’s scaling factor. This is necessary to compensate for the compositor downscaling the surface, for "fake" fractional scaling. But with true fractional scaling, *we* scale the surface to the final size. This means we should *not* use the scaled DPI, but the monitor’s actual DPI. To facilitate this, store both the scaled and the unscaled DPI value in the monitor struct. This patch also changes how we pick the DPI value. Before, we would use the highest DPI value from all the monitors we were mapped on. Now, we use the DPI value from the monitor we were *last* mapped on (typically the window we’re dragging the window *to*). --- wayland.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'wayland.h') diff --git a/wayland.h b/wayland.h index 9e581b20..275338a8 100644 --- a/wayland.h +++ b/wayland.h @@ -315,7 +315,10 @@ struct monitor { } scaled; } ppi; - float dpi; + struct { + float scaled; + float physical; + } dpi; int scale; float refresh; -- cgit v1.3