-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monitor Scaling Factor - text and element too small #6348
Comments
I am not sure I understand your problem.
That's something you get from your OS or SDL/GLFW library. SDL has a |
Sorry for my bad explication. I will try to explain the issue better : So I must find a way to know about the scale factor of my monitor to apply or not apply ScaleAllSize. Or if you have a better way to handle this I am all hearing.
Thanks for this information, but the SDL_GetDisplayDPI will get the same value if it is on a 100% scaled monitor or 200% (which is normal for me). I unfortunately doesn't found a way to get this information with SDL. However I found that GLFW handle this better and have more functions to know about the current scale of the monitor, so I think I will go for this latter. Thanks a lot ! |
Yes of course you are supposed to scale font size and sizes with actual per-monitor scale, not with a fixed number (but you can also provide this option to the user if you like). Sounds like your question is a SDL/GLFW question then.. |
Note that in On Windows, the app needs to notify the OS (via a manifest file or a specific function call) that your app can handle DPI scaling otherwise Windows reports "low dpi" and scale itself, so it becomes invisible to the app. I don't think LInux has a same thing in place. |
Yeah that's more of a SDL/GLFW Issue you are right, sorry. For anyone having the same question as me and using the GLFW backend, you can use
When I use the docking branch and go into However the value is not updated if I change the scaling factor of my monitor when the program is still running. glfw has also this problem, but glfw provide a callback when the monitor scaling change. |
Note the confusion/subtleties between both, the later is only ever != 1.0f on OSX and we currently don't properly support that in your examples and backends.
The code setting that value is in ImGui_ImplSDL2_UpdateMonitors() and does: float dpi = 0.0f;
if (!SDL_GetDisplayDPI(n, &dpi, nullptr, nullptr))
monitor.DpiScale = dpi / 96.0f; So I wonder if you had misused Note that SDL needs the
That's a bug in the SDL backend, note this comment: // FIXME-PLATFORM: SDL doesn't have an event to notify the application of display/monitor changes
static void ImGui_ImplSDL2_UpdateMonitors() I guess since SDL3 is in active development we can ask for this event. GLFW backend should however support it and not have this bug. |
I noticed that SDL3 added a |
I was using GLFW on this one, not SDL. I will maybe retry with SDL now that I have more knowledge
On Wayland with a glfw-wayland it update the value dynamically when I change the scaling, but on Wayland with glfw-x11 it doesn't update automatically. But that is an issue with GLFW, not ImGui. |
Version/Branch of Dear ImGui:
Version: 1.89.5
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_SDL2.cpp + imgui_impl_opengl3.cpp
Compiler: g++
Operating System: Linux (Manjaro Gnome)
My Issue/Question:
My ImGui program with SDL and OpenGl doesn't scale like the rest of my application in my computer. I have a 200% scaling factor on my monitor and the imgui program act like I have a 100% scaling factor. I know that I can use a different font size and use the method ScaleAllSize, but after that my program will not scale correctly on a 100% scale monitor.
I have already read this part of the FAQ : https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-should-i-handle-dpi-in-my-application
And this issue : #1676
But I don't think that they are linked to my issue (correct me if I'm wrong)
My question is : how are we supposed to handle this scaling factor ? How can we get that factor dynamically to resize all the text and elements ?
Screenshots/Video
100% Monitor Scaling Factor :
200% Monitor Scaling Factor :
Standalone, minimal, complete and verifiable example:
Reproductible with minimal example example_sdl2_opengl3
The text was updated successfully, but these errors were encountered: