Per-monitor DPI awareness
Status: proposed. Date: 2026-11-29. Owner approved: no.
Until now voyager7.manifest declared no DPI awareness. Older notes
(docs/history/step6-fixes-2026-11-08.txt, the packaging acceptance) kept "the
system DPI virtualization policy" on purpose. At 125-200% scaling Windows
then drew Voyager7 at 96 DPI and stretched the bitmap, so text was blurry.
Moving a window to a monitor at another scale did not lay it out again.
The owner asked for this to be fixed. Ghostty and Windows Terminal both
render at the monitor's own DPI.
Decision
-
Manifest.
voyager7.exedeclares<dpiAware>true/pm</dpiAware>and<dpiAwareness>PerMonitorV2, PerMonitor</dpiAwareness>. Windows reads it as follows:- Windows 10 1703 and later: Per-Monitor V2.
- Windows 10 1607: per-monitor (v1), plus
EnableNonClientDpiScalinginWM_NCCREATE. - Windows 8.1: per-monitor (v1).
- Windows 7: system aware. Windows 7 has one DPI for every window, and it can only change at sign-in.
voyager7.com(a console launcher with no windows) andvoyager7-setup(alreadytrue) are unchanged. The hook and default-terminal DLLs run inside other processes, which keep their own awareness. -
No new imports.
GetDpiForWindow,GetDpiForMonitor,GetSystemMetricsForDpi,AdjustWindowRectExForDpi,EnableNonClientDpiScalingand the awareness queries are resolved at run time (v7-platform-windows/src/dpi.rs).cargo xtask packagestill passes the Win7 import check. -
One DPI per terminal window. A terminal window records its DPI in the
V7Dpiwindow property:- at
WM_NCCREATE, from Windows:GetDpiForWindowon 10, the monitor's DPI on 8.1, the system DPI on 7; - on every
WM_DPICHANGED, which also moves the window to the rectangle Windows suggests.
The app sees the change from
Window::dpi. It then measures cells and padding again for every surface, and every pane fits its grid again (the PTY is resized when the grid changes). The atlas, colour emoji, the nostalgia bitmap font's whole-pixel scale, the cursor and the kitty cell size all follow from the newGeometry. The swap chains follow the new client size. - at
-
Popups follow their window. Child windows and owned popups take their DPI from their window: the tab strip, caption, menus, palette, toasts, find bar, resize labels and progress bar. Settings and the Inspector record their owner's DPI when they open. After that they keep their own DPI. On their own
WM_DPICHANGEDthey take the suggested rectangle and rebuild their look (fonts, dialog units) and controls. About is made again where it was. A new window gets the DPI of the monitor it opens on. A tab torn off onto another monitor keeps its logical size and its grab point. -
Ambient DPI for drawing helpers. Code that draws without a window at hand (
app_ui::px, the caption and strip units, card shadows) readsdpi::current(). That is the DPI of the window whose message or app-loop turn is running, set by adpi::Scopein every window procedure and in the app loop. Outside any scope it is the system DPI. All UI runs on one thread, so this is one atomic, not thread-local state. -
Windows' own sizes. Two kinds of size are adjusted:
- Fonts from
SPI_GETNONCLIENTMETRICSandSM_CXVSCROLLcome at the system DPI. They are rescaled to the window's DPI. - The frame sizes that Windows draws come from
GetSystemMetricsForDpiandAdjustWindowRectExForDpi, at the DPI Windows gives the window. This covers caption height, resize border and padded border.
- Fonts from
-
Padding.
window-padding-x/-yare points, as in Ghostty (scaledPadding). They become pixels at the window's DPI, which is carried inrender::Place, not at the system DPI. -
+version --fullreports the system DPI and the awareness. It adds each monitor's DPI when one differs from the system DPI. An unaware process still shows what Windows scales it to.
Testing without touching the owner's display settings
The test VMs have one monitor, and their scale is a per-user setting on the
owner's account, so it stays unchanged. --diag-dpi=N makes every window
open at N while the system DPI stays real, as on a second monitor at
another scale. With that flag, message 0x8060 (dpi::DIAG_CHANGE, wParam
= DPI) sends the window the WM_DPICHANGED a move to such a monitor would.
Two things are left untested this way:
- On Windows 10 the frame Windows draws stays at the real DPI, while a real Per-Monitor V2 move scales it.
- Windows 7 never changes DPI at run time. A fake there shows our client drawing at N under a native caption at 96.
Consequences
- The text is sharp at every scale. The window keeps its logical size and layout when it moves between monitors.
system_dpi()keeps its name and now means only the system DPI. New code should useWindow::dpi,dpi::ofordpi::current.- Size cost: 10,240 bytes (
cargo xtask size, 5,301,760 on main 0ce8d9f, 5,312,000 with this change). Most of it is the run-time lookups and the rescaling paths of Settings, the Inspector and About.