mbrlabs / Lorien

Infinite canvas drawing/whiteboarding app for Windows, Linux and macOS. Made with Godot.
MIT License
5.45k stars 234 forks source link

Platform UI scaling #200

Closed Gurchain closed 2 years ago

Gurchain commented 2 years ago

Calculate UI auto scaling based on platform for more accurate scaling. Also wider range of allowed UI scales for some displays.

The scaling for Linux could probably be improved further, but will be much easier if Godot implements better scaling/dpi support in the engine itself.

mbrlabs commented 2 years ago

Thanks! That change makes sense indeed.

The scaling for Linux could probably be improved further, but will be much easier if Godot implements better scaling/dpi support in the engine itself.

What's currently missing? Isn't OS.get_screen_dpi() supposed to work on Linux as well?

Also maybe this would fix #190, but hard to tell based on the non-existint issue description.

Gurchain commented 2 years ago

@mbrlabs I meant that the scaling could more cohesive with the different desktop environments on linux (which dont manipulate the dpi when they scale). It would be better to scale based on what the system scale is rather than calculating the scale from the dpi, but that's not available.

For OS.get_screen_dpi(), the dpi that X11 returns, can be off by like + or - 20 in my experience.

Im also a bit worried about edge cases where a hidpi display return the default X11 dpi (96), but I don't know how often that happens.

If the last point isn't a problem I also have this implementation: Screenshot from 2022-09-02 01-18-18 It works slightly better

mbrlabs commented 2 years ago

Ah i see, good to know. Well i guess the Godot editor workaround is pretty battle-tested, so id's say use that instead. Otherwise it's good to go.

mbrlabs commented 2 years ago

Thanks!