Skip to content
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

Late availability of monitor information #7995

Closed
rokups opened this issue Sep 18, 2024 · 2 comments
Closed

Late availability of monitor information #7995

rokups opened this issue Sep 18, 2024 · 2 comments

Comments

@rokups
Copy link
Contributor

rokups commented Sep 18, 2024

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
Copy link
Owner

ocornut commented Sep 19, 2024

This changed with c111288. (#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 added a commit that referenced this issue Sep 19, 2024
@ocornut
Copy link
Owner

ocornut commented Sep 19, 2024

Pushed the change with 4227250

@ocornut ocornut closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants