From 7e3b8330c9a8497dde3d6b1d73cf327a901ce573 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sat, 17 May 2025 18:20:30 +0200 Subject: [PATCH] ply-utils: Adjust HiDPI cut-off value to 1.625f This matches mutter's behaviour before https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3616 was merged. It first rounded to the newest fractional scale factor (in 0.25 steps) and then rounded N.25 and N.5 down to N and N.75 up to N+1. Commit 3b8e9184 ("ply-utils: Only choose scale 2 when the perfect scale would be >= 1.75") interprets the mentioned difference of at most 0.25 for rounding up very literal. A differnt ionterpretation of https://github.com/GNOME/mutter/commit/d03dce43786ddfaca86a0ec006264c1b0dfd74d9 intend is that it's desireable to round N.5 down. This change has unexpected side effect of using a device scale of 1 for most of Apple's Retina displays in Macbooks (221 - 227 DPI). Raised as https://gitlab.gnome.org/GNOME/mutter/-/issues/4110 in mutter. Using 1.75f cut-off value requires a pixel density of 236.25 for HiDPI while 1.625f requires only 219.375 DPI. Mutter use the same calculation with https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4490 merged. Signed-off-by: Janne Grunau --- src/libply/ply-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c index 782fadd8..13d1f204 100644 --- a/src/libply/ply-utils.c +++ b/src/libply/ply-utils.c @@ -1086,7 +1086,7 @@ get_device_scale (uint32_t width, target_dpi = (diag_inches >= 20.f) ? 110 : 135; perfect_scale = physical_dpi / target_dpi; - device_scale = (perfect_scale >= 1.75f) ? 2 : 1; + device_scale = (perfect_scale > 1.625f) ? 2 : 1; return device_scale; }