Skip to content

Enable ImGui docking + multi-viewport - #791

Merged
Sajeeth-Wimalasuriyan merged 30 commits into
mainfrom
sw-window-docking
Sep 3, 2026
Merged

Sajeeth-Wimalasuriyan merged 30 commits into
mainfrom
sw-window-docking

Conversation

@Sajeeth-Wimalasuriyan

Copy link
Copy Markdown
Contributor
image

…heir own OS window

- Turn on ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_ViewportsEnable
  after ImGui::CreateContext(), and set ConfigViewportsNoTaskBarIcon so
  undocked panels don't spawn taskbar entries
- Add the UpdatePlatformWindows() / RenderPlatformWindowsDefault() pass in
  the main render loop (with GL-context backup/restore for the OpenGL
  fallback path), and reorder so the main backend present() runs after
  the platform-windows pass
- Bump the Vulkan descriptor pool from 100 -> 1024 samplers/sets to give
  secondary platform viewports headroom
- Mark "Main Window" NoDocking so Summary can be the only dockable
  window for now; drop NoSavedSettings from Summary and seed its
  initial pos from GetMainViewport()->WorkPos so it lands inside the
  main window even after viewport coords become absolute screen coords

Replace BeginDragDropSource "is-item-being-dragged?" hacks in two resize
bars (track height, sidebar width) with the proper
IsItemActive() && IsMouseDragging() idiom. The old pattern interacted
badly with imgui-docking's internal window-move drag-drop and would
spuriously resize tracks when other windows were being dragged.

Fix the track reorder "is_reordering" check to validate the payload
type. imgui-docking calls BeginDockableDragDropSource() during any
window-move, setting g.DragDropActive=true with a "_IMWINDOW" payload.
The old check only tested GetDragDropPayload() != null, so with
m_reorder_request.track_id defaulting to 0 the first track appeared to
be reordering (rendered as Dummy) every time another window was
dragged. Now we additionally require payload->IsDataType("reorder_request").

Made-with: Cursor
@tomk-amd

This comment was marked as outdated.

tomk-amd and others added 20 commits April 27, 2026 22:00
Snap secondary viewports to the actual OS window position each frame, then restore the intended drag target before platform window updates.

This fixes WM-clamped drag cases on X11/Xwayland where ImGui keeps an off-screen viewport position, causing hover offsets and corner-lock behavior.
Only run hooks on systems running wayland
glfwShowWindow and glfwSetWindowPos each XFlush internally, and the next glfwPollEvents performs a server round-trip, so an explicit XSync() here turned out to be unnecessary in practice -- which lets us avoid linking libX11.
Introduce a command-line option `--drag-repair` to manage a workaround for drag and click-through issues specific to Ubuntu's Wayland compositor. The implementation includes parsing the option and applying the appropriate settings based on user input or environment variables. Update platform helper functions to support this feature, ensuring compatibility across different Linux distributions.
Update the command-line option `--drag-repair` to clarify its functionality and improve user experience. The description now specifies the trade-off of a brief flicker during drag-release and restricts the default setting to 'off'. Additionally, enhance comments in the platform helper files to better explain the underlying bugs and the rationale for user-controlled fixes, ensuring clarity on the conditions under which workarounds are applied.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	src/app/src/main.cpp
#	src/app/src/rocprofvis_imgui_vulkan.cpp
- Drop the custom rocprofvis_view_set_dpi API and the GLFW
  content-scale callback path. The view now relies on ImGui's
  ConfigDpiScaleFonts / ConfigDpiScaleViewports for per-monitor
  scaling.
- main.cpp enables ImGuiConfigFlags_ViewportsEnable and the DPI
  flags, sets FontScaleMain = 1.0f, and renders platform windows
  via UpdatePlatformWindows / RenderPlatformWindowsDefault while
  preserving the GLFW context for OpenGL.
- Replace the font dropdown with a clamped 13-18 pt slider. User
  settings only persist a base font index; FontManager exposes
  GetMinUserFontSize / GetMaxUserFontSize / GetFontSizeAt /
  GetDefaultFontSizeIndex / ClampFontSizeIndex.
- Fix FontSize indexing bug: ImGui's default font now uses
  FontSize::kDefault (the user-chosen base) instead of
  FontType::kDefault, which had been silently mapping to
  FontSize::kSmall (base - 1). Added static_asserts to keep
  kSizeOffsets in lockstep with the FontSize enum.
- Drop dpi_based_scaling from DisplaySettings and its JSON key;
  SettingsManager no longer tracks DPI.

Co-authored-by: Cursor <cursoragent@cursor.com>
…caling

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Compute the status bar height as the framed content line plus the child
border (FramePadding taken from the default style to match
RenderStatusBar) instead of a magic formula, and remove the
ImGuiWindowFlags_NoScrollbar bandaid. The previous calculation read the
live style and ignored the child border, so the bar could overflow into a
scrollbar under ImGui auto-DPI font scaling.

Co-authored-by: Cursor <cursoragent@cursor.com>
Re-add the GLFW_SCALE_TO_MONITOR hint to both the initial Vulkan window
and the OpenGL-fallback window setup. It was dropped during the DPI
cleanup but is still needed for correct per-monitor window scaling.
Addresses review feedback.

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

# Conflicts:
#	src/app/src/main.cpp
log drag repair state if used
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	src/app/src/main.cpp
#	src/view/src/widgets/rocprofvis_gui_helpers.cpp
remove unused functions
remove unused headers
don't call View namespace objects from main
fix summary merge error
@drchen-amd

drchen-amd commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

Defects:

Ubuntu 22.04:

  • Drag repair arguments seems to not do anything and behavior is always applied. With no arguments set, secondary windows function normally and display minimize animation when being dragged outside, then back inside, main window.
  • When fullscreen, if tooltips/secondary windows make contact with desktop edge, app is kicked out of fullscreen and tooltip/secondary windows become stuck on screen.
Screencast.from.06-15-2026.11.02.50.AM.webm
Screencast.from.06-15-2026.11.10.45.AM.webm

Windows + Ubuntu 22.04:

  • There are a bunch of id conflicts when resizing the "meta area" horizontally.
  • File menu is misaligned and partially outside main view port. image
  • Event tool tips sometimes have incorrect positions.
Screencast.from.06-15-2026.11.17.57.AM.webm
  • The summary window in dark mode while not focused has title bar text and bg with same color. Also this window does not use rounded corners like the others.

Other observations:

  • I'm not a fan of the new font control. When the drag handle is overlapped with the label, the label is somewhat hard to read especially in light mode. I also liked having the -/+ to quickly make fine adjustment. With this slider, your kind of forced to be more precise with your input to get what you want vs the old drop down.
  • Windows outside main view port do not have cursor updates based on hover context. (They do not show resize cursor if hovering an edge/corner)
  • Minimap is 2/3 the size vs main. I point this out because it appears this window cannot be resized.
  • Windows outside main viewport do not have corner rou

@tomk-amd
tomk-amd marked this pull request as draft July 10, 2026 14:41
@tomk-amd

Copy link
Copy Markdown
Collaborator

Changing to draft so noone wastes time trying to review this.. Still too unstable..

Sajeeth-Wimalasuriyan and others added 3 commits August 12, 2026 15:58
The branch's custom-DPI removal already landed on main as the reviewed PR
#892, so the duplicated font/settings/DPI work is dropped in favour of
main's version. The branch's own contributions are reapplied on top of
main's newer code:

- multi-viewport enabled (docking left off) and the Linux/Wayland
  viewport-position and post-drag click-through workarounds
- Linux platform helpers moved into main's RocProfVis::Platform namespace
  alongside the new macOS helpers
- logging initialised before CLI parsing so option diagnostics are captured
- internal build banner drawn on the main viewport
- track resize bars and the sidebar splitter resize via a plain drag
  instead of a payload-less drag-drop source, and track reordering now
  matches on the reorder_request payload type

Co-authored-by: Cursor <cursoragent@cursor.com>
io.ConfigDpiScaleViewports rescales a window's position and size whenever its viewport reports a new DPI. Upstream documents this as a resizing feedback loop for a window straddling a DPI boundary, and since the scaling is lossy the geometry drifts instead of round-tripping. The runaway values then persist to imgui.ini and reload on the next launch. Fonts still scale per monitor through ConfigDpiScaleFonts.

Also stop re-applying the Minimap size every frame. GetResponsiveWindowSize() always clamps to the main viewport, so a Minimap dragged out into its own OS window was held to the wrong monitor's bounds.

Bring rocprofvis_platform_helpers.cpp in line with src/.clang-format.

Co-authored-by: Cursor <cursoragent@cursor.com>
Updates the imgui submodule from v1.92.6-docking to v1.92.9b-docking (docking branch, not master, so multi-viewport stays available). Notable fixes for this branch's viewport usage: the implicit Debug window no longer steals mouse input or blocks merging secondary viewports back into the main one (#9254), HasMouseHoveredViewport is set correctly again, and viewport size is correct under Per-Monitor V2 DPI (#8897).

1.92.7 reworked the Vulkan backend to allocate user textures as separate VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE + VK_DESCRIPTOR_TYPE_SAMPLER descriptors instead of a single COMBINED_IMAGE_SAMPLER, and renamed the reserve macro to IMGUI_IMPL_VULKAN_MINIMUM_SAMPLED_IMAGE_POOL_SIZE. The app owns its descriptor pool, so it must supply both descriptor types or ImGui_ImplVulkan_AddTexture() fails at runtime with VK_ERROR_OUT_OF_POOL_MEMORY. The pool now mirrors the layout the backend builds for its own auto-created pool.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sajeeth-Wimalasuriyan and others added 2 commits August 13, 2026 13:48
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
These are pre-existing issues on main that entered the PR diff for this branch through the merge of origin/main, so code scanning attributes them here.

- test/main.cpp: %ld printed uint32_t row counts, reading eight bytes for a four-byte argument where long is 64-bit.
- compute_summary.cpp, compute_roofline.cpp: %u truncated the uint64_t InvocationCount metric to 32 bits.
- topology_model.cpp: GetDevice returns nullptr on a lookup miss but its result was dereferenced without a guard.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Sajeeth-Wimalasuriyan
Sajeeth-Wimalasuriyan marked this pull request as ready for review August 13, 2026 17:55
@Sajeeth-Wimalasuriyan
Sajeeth-Wimalasuriyan changed the base branch from dev to main August 13, 2026 17:56
GLFW iconifies a fullscreen window on focus loss, so clicking a panel in
its own OS window minimized the whole app. Also fixes F11 being ignored
unless the main window had focus, a geometry check that forced fullscreen
back off mid-transition, and the window losing one title bar of height on
every toggle.
Makes --drag-repair a persisted setting (default off), replacing the env
var and Wayland auto-detection.
@drchen-amd

Copy link
Copy Markdown
Member

Windows

  • In fullscreen, colliding child windows with edge of display causes them to go behind main app. Can be recovered if mouse was not released by dragging back, otherwise they are inaccessible until fullscreen is exited. Some windows like minimap and annotations open directly behind.
Screen.Recording.2026-08-31.194906.mp4
  • Dragging child windows between displays causes them to be sized incorrectly. Not sure if it happens if displays are identical, I tired with 2160p + 1080p combination. Can be recovered by manually resizing.

From 2160p to 1080p:

Screen.Recording.2026-08-31.194319.mp4

(I can only record one display at a time, so this is view of 1080p with main app running on 2160p)

From 1080p to 2160p:

Screen.Recording.2026-08-31.193931.mp4

I couldn't test on ubuntu because my system is busy. I did try it there and saw some different weirdness, but I can't rule out interference from my stress test messing with the input.

Add ROCPROFVIS_MULTI_WINDOW and ROCPROFVIS_ENABLE_TRACE_COMPARE build
options, both defaulting OFF, so the in-development features can be
excluded from a release build.

ViewportsEnable is what every viewport code path on this branch already
tests at runtime, so guarding the one line that sets it also disables
the Linux drag-repair hooks and the platform-window render pass. The
GLFW_AUTO_ICONIFY override and the Linux X11 platform force exist only
to support dragged-out panels, so they are guarded by the same flag,
which leaves Wayland users on native rendering when multi-window is
compiled out.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/app/src/main.cpp Resolved
The post-drag click-through workaround only has anything to repair when
panels can be dragged into their own OS window, so --drag-repair no
longer appears in a build without multi-window support.

Gating the option registration alone would leave configure_drag_repair()
still reading the persisted setting and pushing it into the platform
layer for an option that can no longer be passed, so the whole unit is
guarded: the option, the handler and its call site, the two viewport
position hooks, and the intended-position map that exists only to serve
them.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread .agents/UI.md Resolved
@Sajeeth-Wimalasuriyan
Sajeeth-Wimalasuriyan merged commit 3b3a4e9 into main Sep 3, 2026
9 checks passed
@drchen-amd

drchen-amd commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

This makes the title bar disappear on Ubuntu 22.04 and the font size much larger.

Before and after:
image
image

I didn't change any build flags in between.

drchen-amd added a commit that referenced this pull request Sep 15, 2026
…orm (#1052)

Enabling ImGui docking + multi-viewport (#791) made the X11 platform hint
conditional on ROCPROFVIS_MULTI_WINDOW, which defaults to OFF, so release
builds stopped requesting X11 and GLFW began auto-selecting its Wayland
backend on Linux.

That backend can only decorate a window if it loads libdecor at runtime or
the compositor implements zxdg_decoration_manager_v1. GNOME provides
neither, so GLFW falls back to a blank 24px caption with no title and no
minimize/maximize/close buttons. The same backend switch also broke setting
the window icon and reading the window position, both of which logged
GLFW error 65548 on every startup.

The hint was never only about multi-viewport, so gate it on __linux__ again
as it was before #791. src/app/test/test_main.cpp was left unchanged by that
PR and still forces X11 unconditionally, so this also realigns the app with
its own test harness.

Co-authored-by: drchen <drchen@amd.com>
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.

4 participants