Be smarter about supported fractional scale factors
Problem
@matthiasc, @chergert and me were having a discussion in #gtk about fractional scale factors and which ones are unfortunate to work with.
After investigating we found that https://gitlab.gnome.org/GNOME/mutter/-/blob/main/src/backends/meta-monitor.c#L32-35 is doing a pretty simple list of 25% steps from 100% up to 400% / when the screen would get too small.
It turns out that often when doing math at fractional scales, the inverse is needed. And the inverse of N/4 can be a pretty nasty number - 175% is 7/4 with the inverse of 4/7, 225% is 9/4 with the inverse of 4/9 - those numbers don't deal well with floating point rounding.
An example where this is can be problematic is the size of fullscreen windows. on a 2560x1440 monitor at 175% scale, the window will be sized to 1462x822 pixels (cutting off 6/7 of a pixel on each side) and the Wayland spec-compatible buffer size that the client should create would multiply that by 7/4 to get 2559x1439 - which is missing 1px in each dimension.
Another issue is that when owning multiple monitors of different sizes, it is often not possible to get them to share the same height. For example, I own a 1080p monitor and wanted to buy a 1440p monitor and drive it at a scale of 1440/1080 = 133%, but mutter doesn't offer that. The only way to get them both to share a height is to drive them at 150% and 200%, effectively constricting myself to 720 pixels, which makes windows too big.
Potential solutions
One thing that became obvious is that picking scale factors that play well with sizes and floating point is important - both for the scale factor itself and the inverse. So instead of 175% aka 7/4, offering 166% aka 5/3 or 178% aka 16/9 (Apple does this) is probably better.
Picking scale factors that evenly divide fullscreen and maximized window sizes is also preferrable - 1920, 1080, 1200, 1440 for example have a gcd of 120 (hey, what Wayland spec do I know that number from?
Anyway, I'm posting this memory dump here to get the ball rolling on some improvements to that rather simple (and IMO unfortunate) selection of scale factors.