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

**URL:** <https://discourse.glfw.org/t/glfwinit-makes-existing-windows-lose-scaling-win11-net/2452>\
**Category:** support\
**Created:** [September 18, 2023, 11:33am UTC](https://discourse.glfw.org/t/glfwinit-makes-existing-windows-lose-scaling-win11-net/2452 "2023-09-18T11:33:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugblatterbeast](https://avatars.discourse-cdn.com/v4/letter/b/ec9cab/32.png) [@bugblatterbeast](https://discourse.glfw.org/u/bugblatterbeast)\
**Post date:** [September 18, 2023, 11:33am UTC](https://discourse.glfw.org/t/glfwinit-makes-existing-windows-lose-scaling-win11-net/2452/1 "2023-09-18T11:33:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 18, 2023, 1:48pm UTC](https://discourse.glfw.org/t/glfwinit-makes-existing-windows-lose-scaling-win11-net/2452/2 "2023-09-18T13:48:42Z")

</div>

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`:

> <https://github.com/glfw/glfw/blob/master/src/win32_init.c#L694-L699>

You can use the `GLFW_SCALE_TO_MONITOR` [window hint](https://www.glfw.org/docs/latest/window_guide.html#window_hints) 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](https://www.glfw.org/docs/latest/monitor_guide.html#monitor_scale).

---

<div class="post-metadata">

**Author:** ![bugblatterbeast](https://avatars.discourse-cdn.com/v4/letter/b/ec9cab/32.png) [@bugblatterbeast](https://discourse.glfw.org/u/bugblatterbeast)\
**Post date:** [September 18, 2023, 7:13pm UTC](https://discourse.glfw.org/t/glfwinit-makes-existing-windows-lose-scaling-win11-net/2452/3 "2023-09-18T19:13:28Z")

</div>

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.
