Skip to content

Fix mobile scaling

Port the new Phosh automatic scaling and adjust the mininum adjusted width/height to match. The OnePlus 6 has a calculated scale factor of ~2.2 using this method (aiming for an apparent DPI of 180), we round up to get a sensible scale factor of 3, the same as is used on Phosh.

The current minimum width/height values are quite large and need to be adjusted to be able to work on mobile devices. These adjusted values change the supported scale factors from being up to 250% on the OnePlus 6, to 300%.

The OnePlus 6 has a resolution of 1080x2280 and a screen size of 6.2" diagonally, giving it a DPI of 400.

TODO: Rewrite supported scales to always calculate fractional scale factors, this will let us then always round UP to the next whole value, removing the fractional values afterwards if fractional scaling is disabled. The benefit of this is that a device won't be stuck at 2x or 2.25x scaling when a user might just prefer to go up to 3x.

TODO: The above would let us remove the "hack" which adds the now properly calculated mode scale to the list of supported scale factors.

See: World/Phosh/phoc@9db86680

I'm not sure how best this could be upstreamed but hopefully this is a good proof of concept, it would be nice to avoid having to do "is this a mobile device" detection, although I think the algorithm Arnaud developed should work well on larger displays too.

The other commit is needed to build on alpine, not quite sure why it fails without this, it can be dropped if not applicable.

Merge request reports