Skip to content

Adopt IMGUI DPI to Replace Existing Solution#892

Open
Sajeeth-Wimalasuriyan wants to merge 5 commits into
mainfrom
sw-imgui-dpi
Open

Adopt IMGUI DPI to Replace Existing Solution#892
Sajeeth-Wimalasuriyan wants to merge 5 commits into
mainfrom
sw-imgui-dpi

Conversation

@Sajeeth-Wimalasuriyan

Copy link
Copy Markdown
Contributor

Summary

Replaces the project's custom DPI handling with Dear ImGui's built-in (1.92+) per-monitor DPI font scaling, and turns the font-size preference into a simple user slider.

  • Removes the bespoke DPI machinery: rocprofvis_view_set_dpi, the GLFW content_scale_callback / glfwSetWindowContentScaleCallback wiring, SettingsManager::Get/SetDPI + m_display_dpi, the dpi_based_scaling user setting (+ its JSON key), and FontManager::GetDPIScaledFontIndex.
  • Enables ImGui auto-DPI: sets io.ConfigDpiScaleFonts / io.ConfigDpiScaleViewports, enables multi-viewport (ImGuiConfigFlags_ViewportsEnable) with the UpdatePlatformWindows() / RenderPlatformWindowsDefault() pump in the main loop, and style.FontScaleMain = 1.0f.
  • Font size is now a user slider (SettingsPanel), clamped to a supported range; previously persisted indices are clamped on load for backward compatibility.
  • Drops manual * dpi multipliers on fixed window sizes (shutdown dialog, minimap popup) and makes the internal-build banner viewport/font-scale aware instead of using io.DisplaySize.
  • Status bar height now tracks the current font size via a single guarded check in UpdateStatusBar(), covering both user-driven and DPI-driven font changes (ImGui auto-DPI resizes fonts without firing kFontSizeChanged).

Sajeeth-Wimalasuriyan and others added 2 commits June 18, 2026 16:20
Remove the bespoke DPI plumbing (rocprofvis_view_set_dpi, GLFW content
scale callback, SettingsManager DPI state, dpi_based_scaling setting, and
FontManager::GetDPIScaledFontIndex) in favor of ImGui's built-in DPI font
scaling (ConfigDpiScaleFonts/ConfigDpiScaleViewports + multi-viewport).

The font size setting becomes a plain user-controlled slider clamped to a
supported range, and fixed window sizes no longer multiply by a manual DPI
factor. The status bar height now follows the current font size via a
single guarded check that handles both user- and DPI-driven font changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Collapse the verbose multi-line comments and remove the defensive
static_assert block added with the DPI rework so the comments stay
terse and consistent with the rest of the view layer. No behavior change.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/view/src/rocprofvis_appwindow.cpp Outdated
// Auto-DPI changes the font size without firing kFontSizeChanged, so
// resize the status bar slot whenever the font size changes.
const float font_size = ImGui::GetFontSize();
if(font_size != m_last_font_size)
Sajeeth-Wimalasuriyan and others added 2 commits June 19, 2026 10:35
Remove the multi-viewport/windowing enablement (ViewportsEnable and the
platform-window render pass) that main does not have, and revert the
font-size slider redesign, font-range clamp, extra FontManager helpers,
and incidental gui_helpers rewrite. The branch now only swaps the custom
DPI handling for ImGui's built-in DPI font scaling (ConfigDpiScaleFonts),
keeping the status bar sizing and banner scaling needed under it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the font-size dropdown with a slider (in points) bounded to a
supported range, and clamp the saved index on load/apply. The upper bound
keeps the UI font from growing too large under ImGui DPI font scaling.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/view/src/rocprofvis_appwindow.cpp Outdated
Detect the applied font size once per frame in FontManager::Update so both user-selected sizes and ImGui auto-DPI scaling notify every kFontSizeChanged subscriber, and revert AppWindow's private status-bar poll back to a normal subscription.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

3 participants