Glfwinit() makes existing windows lose scaling (win11 .NET)

I have a test project set up with .NET 6.0 that I run on a Windows 11 workstation. In the display settings of that workstation the scale factor is set to 150%.
When I call glfwinit(), all the existing windows of that test project are losing that scale factor and shrink down to their original size. New windows that I open with glfw are not scaled as well.
I don’t mind, that new windows are opened without scaling but it bothers me, that existing windows shrink.

GLFW isn’t really designed to be used in a program which already has other windows opened, and so it sets the process DPI awareness which is likely what causes the other windows to change. See the code in _glfwInitWin32:

You can use the GLFW_SCALE_TO_MONITOR window hint to ensure GLFW scales it’s windows to the monitor for you automatically, but this will not apply to the already created windows.

Without altering GLFW one solution would be to initialize GLFW before creating the other windows and then setting their size/scale (if possible) using the monitor content scale.

1 Like

Thank you very much for your help!
I went for the quickest solution. Commenting out those lines from GLFW source solved the issue for me.