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 <j@jannau.net>
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;
}