Display scale and HiDPI on both platforms #15

Open
UnflavoredMeson/Primal_Plus_Plus
opened 2026-11-24 20:15:52 +00:00 by UnflavoredMeson · 0 comments
Owner

Why

On a scaled display, windows come out the wrong size and text later blurs. The editor (S7) needs the scale per window to size its fonts.

Decided

  • Per-monitor DPI awareness on Windows (manifest + WM_DPICHANGED), SDL3's display scale on Linux.
  • The platform layer reports a window's scale; sizes in the API are in pixels, and the scale is a separate value.
  • Pointer, text input, clipboard and cursor events come with S7-01, when the editor needs them.

Read first

  • UnflavoredMeson/Primal#15.

Steps

  • 1. Add the Windows manifest setting and handle WM_DPICHANGED.
  • 2. Add window::display_scale() on both platforms.
  • 3. Check on a 150% display that the window EngineTest opens at the size it asks for in pixels.

Done when

  • Both OSes report the right scale on a scaled display; 0 warnings; tidy 0.

Claude can help with

  • The Win32 DPI API details (there are three generations of them).

Learn

  • The difference between logical and physical pixels, and who converts.
## Why On a scaled display, windows come out the wrong size and text later blurs. The editor (S7) needs the scale per window to size its fonts. ## Decided - Per-monitor DPI awareness on Windows (manifest + `WM_DPICHANGED`), SDL3's display scale on Linux. - The platform layer reports a window's scale; sizes in the API are in pixels, and the scale is a separate value. - Pointer, text input, clipboard and cursor events come with S7-01, when the editor needs them. ## Read first - `UnflavoredMeson/Primal#15`. ## Steps - [ ] 1. Add the Windows manifest setting and handle `WM_DPICHANGED`. - [ ] 2. Add `window::display_scale()` on both platforms. - [ ] 3. Check on a 150% display that the window EngineTest opens at the size it asks for in pixels. ## Done when - [ ] Both OSes report the right scale on a scaled display; 0 warnings; tidy 0. ## Claude can help with - The Win32 DPI API details (there are three generations of them). ## Learn - The difference between logical and physical pixels, and who converts.
Sign in to join this conversation.
No assignees
No project
Blocks
#39 Dear ImGui in the engine
UnflavoredMeson/Primal_Plus_Plus
Depends on
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
UnflavoredMeson/Primal_Plus_Plus#15
No description provided.