ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.15k stars 10.3k forks source link

Late availability of monitor information #7995

Closed rokups closed 1 month ago

rokups commented 1 month ago

Version/Branch of Dear ImGui:

Version 1.91, Branch: docking

Back-ends:

imgui_impl_sdl2.cpp

Compiler, OS:

Not applicable

Full config/build information:

No response

Details:

At some point within last year or so behavior of library changed, and now ImGui_ImplSDL2_UpdateMonitors() (and respective functions of other backends) are first called during NewFrame(). This means monitor information is not available during initial setup. I have a HDPI support patch, which involves baking font atlases for each DPI. This is done each time font is added, which happens during initial setup as well. To fix my patch i had to modify SDL2 backend, to make ImGui_ImplSDL2_UpdateMonitors() non-static and call it early enough so i can work with monitor information. I probably should fix my patch, however i think it would be useful to have monitor information earlier. Maybe ImGui_ImplSDL2_UpdateMonitors could also be called from ImGui_ImplSDL2_Init*?

Thanks for considering it

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

ocornut commented 1 month ago

This changed with c11128891. (#6348)

I will work something out. Btw it is likely that in following semester we will head toward making examples on master DPI aware which will probably involve moving some of this into master and adding missing functions (e.g. dpiscale from window/hwnd, dpiscale from monitor).

ocornut commented 1 month ago

Pushed the change with 4227250