Skip to content

Show the mouse cursor widgets ask for - #594

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/project-thread-7evptx
Oct 7, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/project-thread-7evptx

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: the pointer was an arrow everywhere in an ImGuiApp window. Splitters, window edges, text fields and every custom widget showed the same arrow, even where ImGui or Hexa had already asked for a resize or text cursor.

After: the pointer changes with what a press will do. Text fields show a beam, splitters and window edges show resize arrows, click targets such as switches, chips, segments, stars, piano keys, step cells and page dots show a hand, and drag targets show a resize or move cursor (range slider, handle track, fader, knob, XY pad, colour wheel, curve points, canvas panning).

The root cause was in ImGui.App, not the widgets: Dear ImGui only records the cursor a frame wants, and the OpenGL controller never passed it on to the window.

How: a new PlatformCursor maps ImGui.GetMouseCursor() onto Silk.NET's ICursor after each frame, writing only on change, and leaves alone a pointer the app has captured or hidden, NoMouseCursorChange, and MouseDrawCursor. The controller now declares ImGuiBackendFlags.HasMouseCursors, which also turns on ImGui's resize-from-window-edges. In ImGui.Widgets, a small WidgetCursor.OnLastItem helper sets the cursor on the widgets that lacked one. Plain buttons, including ToolbarButton, keep the arrow, as ImGui's own buttons do, and so do read-only or click-less instances. The headless harness declares the same flag and exposes ImGuiAppHarness.MouseCursor, so each widget's cursor is asserted in its isolation suite (25 new UI tests), with unit tests for the mapping. CLAUDE.md and the App README describe the policy.

Every test project passes locally in Release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UkEDGUXpnDhgpb3k1t2Kyb


Generated by Claude Code

The OpenGL controller never carried ImGui's requested cursor to the window, so every
resize, hand and text-beam cursor was dropped. PlatformCursor now applies it after each
frame, the backend advertises HasMouseCursors, and the custom widgets that lacked one set
a hand on click targets and resize or move cursors on drag targets. The headless harness
exposes the frame's cursor so the widget suites assert each one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkEDGUXpnDhgpb3k1t2Kyb
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

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