Skip to content

Fixed DPI on MacBook Liquid retina screens#264

Merged
michaelsakharov merged 2 commits intoProwlEngine:New-Editorfrom
PaperPrototype:fix-liquid-retina-dpi
Apr 27, 2026
Merged

Fixed DPI on MacBook Liquid retina screens#264
michaelsakharov merged 2 commits intoProwlEngine:New-Editorfrom
PaperPrototype:fix-liquid-retina-dpi

Conversation

@PaperPrototype
Copy link
Copy Markdown
Contributor

@PaperPrototype PaperPrototype commented Apr 27, 2026

This PR fixes DPI scaling issues for MacBook liquid retina screens.

Screenshot of MacBook DPI scaling now fixed:

Screenshot 2026-04-26 at 9 15 09 PM

Screenshot of external monitor which was working before and still works:

Screenshot 2026-04-26 at 9 13 03 PM

@sinnwrig @michaelsakharov @ZeppelinGames I need a PR review, if anyone could confirm that this doesn't break anything on your end?

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.
@PaperPrototype
Copy link
Copy Markdown
Contributor Author

PaperPrototype commented Apr 27, 2026

Note:

this was 100% done with claude code working with me to feed it debug logs to test different things until it figured it out.

This is what claude said the root cause was after deliberating with it for awhile:

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.

@PaperPrototype
Copy link
Copy Markdown
Contributor Author

Tested on 1080p monitor:

Screenshot 2026-04-26 at 9 33 55 PM Screenshot 2026-04-26 at 9 34 23 PM

@michaelsakharov
Copy link
Copy Markdown
Contributor

Ill have to test it on my own monitors when I get back today.

…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.
@PaperPrototype
Copy link
Copy Markdown
Contributor Author

PaperPrototype commented Apr 27, 2026

image image

Now working on Windows and Mac confirmed :)

@PaperPrototype
Copy link
Copy Markdown
Contributor Author

PaperPrototype commented Apr 27, 2026

Tested working on:

MacOS

  • (main) XDR 3024 x 1964 with DPI of 2.0 (built in, Liquid Retina)
  • (extended) 2560 x 1440 with DPI of 2.0 (Philips)
  • (extended) 1920 x 1080 with DPI of 1.0 (asus)

Windows

  • (main) 1920 x 1080 with DPI of 1.0 (built in)
  • (extended) 2560 x 1440 with DPI of 2.0 (Philips)
  • (extended) 1920 x 1080 with DPI of 1.0 (asus)

But for some reason it fails for Zekro.

The screenshot he sent has a resolution of 2559 × 1343 which is very close to 2560 × 1440. Deducing from that I think maybe his DPI scale was 2.0? Though I have no idea how big his monitor was IRL. It's possible the monitor is quite big so that is why everything was small? I would need to see what the scale of his surrounding windows UI is (eg. taskbar titlebar etc).

zekro-prowl-ui

@michaelsakharov michaelsakharov merged commit 3b72966 into ProwlEngine:New-Editor Apr 27, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants