Fix editor auto display scale on Windows #111326
Open
+16
−9
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.
The problem: I have my system display scale factor set to 175%. But the Godot editor fails to detect it, the UI is very small and the editor setting says
Auto (100%)
.The editor is currently using a strange way to determine the default scale:
godot/editor/settings/editor_settings.cpp
Lines 1832 to 1846 in d413181
My screen resolution is 2560x1600 and the DPI reported is 168. So the scale is indeed 100% according to this algorithm.
According to MSDN, the DPI reported by
GetDpiForMonitor(type=MDT_DEFAULT)
shows the correct factor for scaling UI elements (with 96 as 100%). I believe the default scale can be as easy as dividingscreen_get_dpi()
with 96.In this PR, I also:
screen_get_dpi()
to avoid enumerating the monitors twicescreen_get_dpi()
from 72 to 96 as it means 100% scale on Windows