Fix GLFW DPI scale when high-density framebuffers are disabled #2399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a DPI/content-scale mismatch in the GLFW backend that caused ImGui and app rendering to shift (and sometimes disappear in fullscreen) during resize. Reproducible in the ImGui sample.
WindowImplGlfw::getContentScale()returned the monitor DPI scale even when high-density framebuffers were disabled. Code usingtoPixels()(including ImGui) then over-scaled coordinates relative to the actual framebuffer size.Before the current GLFW rewrite,
Window::getContentScale()returned1.0ffor GLFW/Linux, which masked the mismatch.Fix:
Gate GLFW content scale by the app’s high-density setting:
isHighDensityDisplayEnabled()is false, return 1.0fglfwGetWindowContentScale()as before