Quick answer: ImGui docking-branch viewports rendering at the wrong size when dragged to a second monitor? Cross-monitor DPI mismatch — you need to update the platform window after monitor moves.
Editor windows detached from the main viewport render at half-size on a HiDPI second display. ImGui didn’t scale for the new monitor.
Monitor Move Callback
Hook the platform’s window-moved callback. When the window’s monitor changes, query the new DPI and update ImGui’s viewport scale.
Update Viewport Size
viewport->DpiScale = newDpi / 96.0f;
ImGui_ImplWin32_SetWindowSize(viewport, newSize);The viewport struct carries DPI. ImGui scales fonts and metrics based on it; without an update, content stays at the old scale.
Per-Monitor v2 Awareness
On Windows, declare per-monitor DPI awareness v2 in your app manifest. Without it, Windows lies about DPI and ImGui sees stale numbers.
Font Atlas Reload
Pure DPI scaling can blur fonts. For pixel-perfect rendering on HiDPI, reload the font atlas at a higher resolution and scale glyph metrics accordingly.
Verifying
Detached ImGui windows render at correct DPI on any monitor. Dragging between monitors updates the size smoothly.
“Monitor changes need DPI updates. Hook the window-moved callback.”
Declare per-monitor v2 awareness in the manifest from day one — retrofitting later means re-tuning every UI metric.