ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
616 stars 104 forks source link

DPI scaling is incorrectly determined on X11 Linux #724

Open whitequark opened 5 months ago

whitequark commented 5 months ago

This happens because it uses GLFW and GLFW currently retrieves content scale via "folklore heuristics" (their words) which do not really work: https://github.com/glfw/glfw/blob/b35641f4a3c62aa86a0b3c983d163bc0fe36026d/src/x11_init.c#L990-L1023

On X11 there's no unified way to do this. The best you could do in a fully arch-independent manner is to query RandR display DPI, but that's kind of a pain to do. An alternative is to look at GDK/Qt environment variables.

whitequark commented 5 months ago

I've submitted https://github.com/ngscopeclient/scopehal-apps/pull/725 as an example of how to make DPI scaling determination work pretty okay on X11 Linux, but it still needs to be tested on Wayland Linux, Windows, and macOS. Personally I'm willing to do that once the ffts dependency is no longer something I have to build.

nemanjan00 commented 4 months ago

Scaling also seems to be completely broken on Wayland. (Sway)

I am not sure if cause is also GLFW

20240701_13h47m09s_grim 20240701_13h47m25s_grim

I have a hack (temporary "solution") that might help some people.

It does seem to at least fix cursor alignment to buttons and to render with reasonable resolution

gamescope -W 1440 -H 900 -r 60 -- ngscopeclient

20240701_13h53m47s_grim

MonarchActual commented 1 month ago

I have the same issue on wayland (sway). gamescope also does not work because of an issue with my intel integrated GPU. As a workaround I use Xwayland using XDG_SESSION_TYPE=x11. This works fine for me but I am using the default scale of 1 / DPI of 96.