Skip to content

Enable ImGui docking + multi-viewport#791

Open
Sajeeth-Wimalasuriyan wants to merge 22 commits into
devfrom
sw-window-docking
Open

Enable ImGui docking + multi-viewport#791
Sajeeth-Wimalasuriyan wants to merge 22 commits into
devfrom
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

Copy link
Copy Markdown
Collaborator

There is a bug where the overlapping window disappears (gets pushed to back) if it is clicked and dragged, and then clicked again.

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

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