Skip to content

Adopt IMGUI DPI to Replace Existing Solution#892

Merged
Sajeeth-Wimalasuriyan merged 9 commits into
mainfrom
sw-imgui-dpi
Jul 22, 2026
Merged

Adopt IMGUI DPI to Replace Existing Solution#892
Sajeeth-Wimalasuriyan merged 9 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 Fixed
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>
@amokiche-amd

Copy link
Copy Markdown
Contributor

I think the font size slider should have a wider range of values. Some people might use the tool on a huge monitor with a lower resolution, while others might use it on a laptop. Right now, if I run the app on a laptop and set the font size to the maximum, I'm comfortable with it, but I can easily imagine people who might find the text too small.

Comment thread src/view/src/rocprofvis_font_manager.cpp Outdated
Comment thread src/view/src/rocprofvis_font_manager.cpp Outdated
Comment thread src/view/src/rocprofvis_font_manager.cpp Outdated
Widen the user font-size range, fold GetClosestFontSizeIndex into a member using std::lower_bound, use std::clamp for index clamping, and compare effective font size with an epsilon in Update().

Co-authored-by: Cursor <cursoragent@cursor.com>
@tomk-amd

Copy link
Copy Markdown
Collaborator

I think Derek mentioned this on the mulit-view PR that had a version of this DPI refactor included... The mini-map is tiny. The mini map window needs to be bigger.

image

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/view/src/widgets/rocprofvis_gui_helpers.cpp
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	src/view/src/rocprofvis_appwindow.cpp
#	src/view/src/rocprofvis_settings_manager.cpp
#	src/view/src/rocprofvis_settings_manager.h
#	src/view/src/widgets/rocprofvis_gui_helpers.cpp
@Sajeeth-Wimalasuriyan
Sajeeth-Wimalasuriyan merged commit 6820718 into main Jul 22, 2026
9 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.

4 participants