Fix double UI scaling on macOS Retina displays - #3087
Open
La1itchauhan wants to merge 2 commits into
Open
La1itchauhan wants to merge 2 commits into
La1itchauhan wants to merge 2 commits into
Conversation
On macOS, ImGui already compensates for Retina high-DPI displays via io.DisplayFramebufferScale. The existing code additionally reads glfwGetWindowContentScale() and multiplies the font size and style metrics by it, resulting in text that appears twice as large as intended in the property panel, main menu, and graph panel title area. This fix wraps the content-scale query in a platform guard so that it only runs on Windows and X11, where the framebuffer is unscaled and the content scale is the only way to account for DPI. Fixes AcademySoftwareFoundation#3077
|
|
Member
|
Thanks for this proposal, @La1itchauhan! Can you add a comment on the GitHub Issue that you're tackling, so that we can assign it to you? Also, let us know if this contribution is part of ASWF Dev Days, so that we'll know whether to assign the Dev Days 2026 label as well. |
Author
|
Thanks for the heads up! I've commented on the original issue (#3077) . I'd be happy for this to be counted as part of ASWF Dev Days 2026 please go ahead and add the label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #3077
On macOS Retina displays, text in the property panel, main menu, and graph panel title area appears twice as large as intended.
Root Cause
ImGui already compensates for Retina high-DPI displays internally via
io.DisplayFramebufferScale. The existing code inMain.cppadditionally readsglfwGetWindowContentScale()and multiplies the font size and style metrics by it, resulting in double scaling.Fix
Wrap the
glfwGetWindowContentScale()query in a platform guard (#if !defined(__APPLE__)) so that it only runs on Windows and X11, where the framebuffer is unscaled and the content scale is the only way to account for DPI. On macOS,deviceScaledefaults to1.0f, allowing ImGui to handle DPI scaling on its own.Changes
source/MaterialXGraphEditor/Main.cpp: Added#if !defined(__APPLE__)guard around the content-scale query block.Testing
glfwGetWindowContentScale()continues to provide the DPI multiplier as before.deviceScaleremains1.0f, preventing the double scaling. The--uiScaleCLI option still works as an additional user-specified multiplier on all platforms.