Skip to content

Make DividerContainer respect the ImGui draw cursor#223

Merged
matt-edmondson merged 4 commits into
mainfrom
claude/stoic-faraday-con71l
Jun 14, 2026
Merged

Make DividerContainer respect the ImGui draw cursor#223
matt-edmondson merged 4 commits into
mainfrom
claude/stoic-faraday-con71l

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

DividerContainer.Tick() previously hard-positioned the container at GetWindowPos() + WindowPadding and sized it to the full GetWindowSize(), so it always filled the host window from its top-left corner — ignoring the current ImGui layout/draw cursor. This made it impossible to draw content above the container or place it anywhere but the top of a window.

This change lays the container out from GetCursorScreenPos() using GetContentRegionAvail(), so it starts at the current draw cursor and occupies the remaining content region.

Behavior

  • When the container is the first thing drawn in a window, the two approaches are equivalent (GetCursorScreenPos() == GetWindowPos() + WindowPadding and GetContentRegionAvail() == GetWindowSize() - 2*WindowPadding), so existing usage (e.g. the demo, where the container fills the whole window) is unchanged.
  • When content has already been drawn (text, a menu bar, indentation, etc.), the container now correctly starts below/after it and fills only the remaining space, and the host cursor advances past the container so subsequent widgets don't overlap.

Changes

  • ImGui.Widgets/DividerContainer.cs: replace window-relative origin/size with cursor-relative origin (GetCursorScreenPos) and available-region size (GetContentRegionAvail).

Testing

Could not run dotnet build/dotnet test in this environment: the only installed SDK is 10.0.108, but ktsu.Sdk.Analyzers 2.9.0 requires Roslyn 5.3 (SDK 10.0.3xx), so every project fails with CS9057 regardless of this change, and the matching SDK can't be downloaded due to the network policy. The change is a small, mechanical substitution of the layout origin/size sources.

https://claude.ai/code/session_014DX1uH9hzVfcrtYG9euNpA


Generated by Claude Code

claude added 4 commits June 14, 2026 00:25
Tick() previously hard-positioned the container at GetWindowPos() +
WindowPadding and sized it to the full GetWindowSize(), so it always
filled the host window from its top-left corner regardless of where the
layout cursor was. This made it impossible to draw content above the
container or place it anywhere but the top of a window.

Lay the container out from GetCursorScreenPos() using
GetContentRegionAvail() instead, so it starts at the current draw cursor
and occupies the remaining content region. Behavior is unchanged when
the container is the first thing drawn in a window (the two values are
equivalent in that case).

https://claude.ai/code/session_014DX1uH9hzVfcrtYG9euNpA
The ktsu.Sdk analyzer (KTSU0005) failed the build because three
PackageVersion entries were not referenced by any project:
ktsu.RoundTripStringJsonConverter, ktsu.FuzzySearch, and
Microsoft.Testing.Extensions.CodeCoverage. Remove them so central
package management only lists packages that are actually consumed.

https://claude.ai/code/session_014DX1uH9hzVfcrtYG9euNpA
The ktsu.Sdk analyzer (KTSU0006) requires that any package whose types
are used directly is referenced explicitly rather than pulled in
transitively.

- ImGui.App: reference the Silk.NET sub-packages it uses directly
  (Silk.NET.Core, Silk.NET.Maths, Silk.NET.Input.Common,
  Silk.NET.Windowing.Common) in the non-iOS item group, since that code
  is excluded or #if !IOS-gated on iOS. Add matching PackageVersion
  entries for central package management.
- ImGui.Widgets: reference ktsu.Extensions, ktsu.ScopedAction and
  ktsu.Semantics.Strings, which it uses in DividerContainer, ScopedDisable
  and Combo respectively.

https://claude.ai/code/session_014DX1uH9hzVfcrtYG9euNpA
The KTSU0006 analyzer flagged the demo projects for using types from
transitive packages. Reference them explicitly:

- ImGuiWidgetsDemo: Hexa.NET.ImGui, ktsu.Semantics.Paths,
  ktsu.Semantics.Strings, ktsu.TextFilter
- ImGuiPopupsDemo: Hexa.NET.ImGui, ktsu.Semantics.Strings
- ImGuiStylerDemo: Hexa.NET.ImGui, ktsu.ThemeProvider

ImGuiAppDemo already declared all of its direct dependencies.

https://claude.ai/code/session_014DX1uH9hzVfcrtYG9euNpA
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@matt-edmondson matt-edmondson merged commit 64bac55 into main Jun 14, 2026
4 of 7 checks passed
@matt-edmondson matt-edmondson deleted the claude/stoic-faraday-con71l branch June 14, 2026 02:02
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.

2 participants