DPI fix (part 2)#267
Merged
michaelsakharov merged 3 commits intoProwlEngine:New-Editorfrom Apr 27, 2026
Merged
Conversation
The root cause was that PreparePaperFrame was dividing Paper's resolution by ContentScale — on a 1x monitor cs=1 so this was a no-op and everything worked, but on Retina cs=2 so Paper's logical space was halved while the projection still covered the full 3024px framebuffer, leaving the UI crammed into the top-left quarter at half size.
…indowContentScale glfwGetWindowContentScale returns the system DPI factor (e.g. 1.5) even when the process is DPI-unaware, where the OS virtualises the framebuffer so fbSize == winSize. The new PreparePaperFrame (resolution = winSize, scale = cs) then produced vertices spanning winSize × 1.5 > fbSize, pushing the UI off-screen on any Windows machine with DPI > 100%. The fb/win ratio is always the correct value: it measures actual pixel density from the app's coordinate perspective regardless of platform or DPI-awareness mode. On macOS the GLFW proc already failed and fell back to this ratio; now Windows uses the same path.
…ime and this is the fix. Now I just need to test on mac On DPI-unaware Windows, winSize == fbSize but glfwGetWindowContentScale still returns the real system DPI (1.25, 1.5, etc.). The PR's formula used winSize as Paper's resolution, so vertex_max = winSize × cs > fbSize. The pre-PR formula happened to work because it divided winSize by cs first and then multiplied back via scale = cs, which collapsed to winSize = fbSize. Fix: Always derive resolution from fbSize / (cs × us) so vertex_max = fbSize regardless. Mouse and cursor also get a separate csFbWin = fbSize/winSize factor — on macOS csFbWin == cs so it cancels out (no behavior change), but on DPI-unaware Windows csFbWin = 1 while cs = 1.25, so the division by cs correctly maps the mouse into the compressed paper space.
Contributor
Author
|
Only does "TryGetContentScaleViaProc" for windows |
Contributor
Author
|
Okay confirmed it still works on macos |
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.
Still works on windows just need to test on macos