Skip to content

fix(ariadne): windows fit their content, scroll what doesn't fit, and reopen from a Windows menu - #828

Merged
transfix merged 3 commits into
masterfrom
fix/ariadne-window-autofit
Oct 29, 2026
Merged

transfix merged 3 commits into
masterfrom
fix/ariadne-window-autofit

Conversation

@transfix

Copy link
Copy Markdown
Owner

Summary

A window with no size: drew as a 32 px stub in the ImGui backend. volren_bunny, volslice_bunny and mesh_lab showed every control window as one stub at (60, 60).

Cause. On a new window's hidden measuring frame, ImGui's size is its 32 px minimum. The backend reported that as the §11.4 geometry. The core persisted it and seeded it back on the next frame, and SetWindowSize with a size > 0 cancels ImGui's auto-fit.

What changes

ImGui backend

  • A window reports no geometry while it is still fitting. backend.h documents the contract.
  • While fitting, labeled widgets are measured at ImGui's auto-resize width (16 font sizes).
  • The fit stops at the edge of the view, but never below an authored min:.
  • Every window gets a horizontal scroll bar as well as the vertical one.
  • Windows with no pos: and no persisted geometry flow down the left edge in columns instead of stacking at ImGui's (60, 60). A window opened later goes after the rest.
  • Combo and colour widgets reserve room for their labels, like sliders and inputs already did.

FTXUI. An unsized window stops at the screen's edge. A body larger than its window becomes a frame with a scroll bar that follows focus.

Windows menu (core, ARIADNE.md §5.9). Requested via the tf_editor work: "the windows should be openable from the main menu if they have been closed".

  • It has a ticked item per window, bound to tree.<id>.open, so a closed window can always be opened again.
  • It lists only the windows the document's own menus don't already toggle. lsystem_forest's Settings menu and conference_roster's View menu are untouched, and windows made by repeat: are not listed.
  • It goes after the document's menus. A document with no menubar but a closable window gets a menubar for it.
  • Every window now honours tree.<id>.open.
  • - windows_menu: <title> in a menubar places it there; a top-level windows_menu: false turns it off.
  • It is drawn through the ordinary menu calls, so ImGui, FTXUI and the tvision host all show it.

Docs. ARIADNE.md §5.8 (sizing) and §5.9 (Windows menu). The "collapsed stub" caveats are removed, and the roadmap §3.0.3b has a note on the change.

Tests

  • New cvcgl_imgui_window_fit: headless, 32 checks covering fit, scrolling, small viewport, persisted geometry and authored size winning, flow placement, late-opened windows, and row splits. 16 of the checks fail against master's backend.
  • New cvcgl_imgui_windows_menu: closes a window, then reopens it by clicking through ImGui input.
  • ariadne_runtime_test: fit contract, plus 4 Windows-menu cases.
  • ariadne_loader_test: windows_menu parsing.
  • ariadne_ftxui_test: 4 sizing/scroll cases and reopening from the menu. The hosted test now expects the Windows menu in the host's menu model.
  • Goldens: windows.png changes because its over-wide line now scrolls and its closable window brings a menubar. menus.png changes because of the Windows menu title. Both were regenerated under Mesa llvmpipe on Windows (mesa-dist-win 26.1.7, the CI pin); the other three goldens match that renderer within 1.

Verified (Windows, Release + shared)

  • Before the Windows menu was added: ctest -R "Ariadne|ariadne|cvcgl" passed 505/507. The two failures were fixed (a test's glyph expectation, and the windows golden) and re-run green.
  • After the Windows menu: the build is green and all goldens pass under llvmpipe. The full suite re-run is in progress; results will follow in a comment.
  • arigl snapshot of the three demos and hello.ari, plus an interactive arigl run, show every window open, fitted and non-overlapping.

… reopen from a Windows menu

A window with no size: drew as a 32 px stub in the ImGui backend. On a new window's hidden
measuring frame ImGui's size is its 32 px minimum; the backend reported it as the §11.4
geometry, the core persisted it and seeded it back next frame, and SetWindowSize with a size
cancels ImGui's auto-fit. volren_bunny / volslice_bunny / mesh_lab showed every control window
as one stub at (60, 60).

ImGui backend:
- report no geometry while a window is still fitting (backend.h documents the contract)
- measure labeled widgets at ImGui's auto-resize width (16 font sizes) while fitting
- stop the fit at the view's edge, never below an authored min:
- give every window a horizontal scroll bar as well as the vertical one
- flow windows with no pos: and no persisted geometry down the left edge in columns,
  instead of stacking at ImGui's (60, 60); a window opened later goes after the rest
- reserve label room for combo and colour widgets too, like sliders and inputs

FTXUI: an unsized window stops at the screen's edge, and a body larger than its window becomes
a frame with a scroll bar.

Windows menu (core, so ImGui, FTXUI and the tvision host all get it): a ticked item per window,
bound to tree.<id>.open, for the windows the document's own menus don't already toggle. It goes
after the document's menus; a document with no menubar but a closable window gets one for it.
Every window now honours tree.<id>.open. A `- windows_menu: <title>` menubar entry places it, a
top-level `windows_menu: false` turns it off.

Docs: ARIADNE.md §5.8 (sizing) and §5.9 (Windows menu); the stub caveats are gone. Tests:
cvcgl_imgui_window_fit, cvcgl_imgui_windows_menu (new), ariadne_runtime_test,
ariadne_loader_test, ariadne_ftxui_test. Goldens: windows.png (the over-wide line scrolls; the
menubar for its closable window) and menus.png (the Windows menu), regenerated under Mesa
llvmpipe.
@transfix

Copy link
Copy Markdown
Owner Author

Local run on 637dced (Windows, Release + shared): ctest -R "Ariadne|ariadne|cvcgl" passed 514/514. That includes cvcgl_imgui_window_fit, cvcgl_imgui_windows_menu and cvcgl_ari_golden on this box's GPU. All five goldens also pass under Mesa llvmpipe.

Master's #820 landed its own window fitting in the ImGui backend: a window with no size: fits its
widgets every frame and takes no size from its persisted geometry, windows with no pos: stack down
the left of the work area around the windows that stand where they are, a sized window scrolls both
ways, and an authored pos: is measured from below the menu bar. That replaces this branch's ImGui
sizing (fit once, report no geometry while fitting, its own flow cursor), so ImGuiBackend.h/.cpp
and cvcgl_imgui_window_fit.cpp are master's, and backend.h's contract and the roadmap's §11.4 text
are master's again. The runtime test of the dropped contract (a fitting window's geometry is not
persisted) goes with it.

What this branch still adds on top:

- The core's built-in Windows menu (ARIADNE.md §5.9), and tree.<id>.open honoured by every window.
  A host's menus count as the document's, so arigl's Settings > Keys... keeps the Keys window out
  of it; under a host without such a menu the Windows menu is how the Keys window opens. A menu
  already in the bar with the Windows menu's title, like fem_gallery.ari's own Windows menu, now
  takes the built-in items after a separator instead of a second menu of the same name in the bar.
- The FTXUI backend stops an unsized window at the screen's edge and scrolls a body that does not
  fit.
- In a sized ImGui window a combo or colour widget reserves room for its label, like a slider or
  an input.

The loader takes both master's keys: and this branch's windows_menu: (block, schema, widget type).
ARIADNE.md §5.8 describes master's ImGui sizing; §5.9 gains the host-menu and same-title rules. The
duplicate cvcgl_imgui_window_fit target from the merge is gone. cvcgl_imgui_windows_menu also checks
that a reopened window takes its place in the column without landing on another, and that a window
stands below the menu bar the Windows menu brings. New runtime tests cover the same-title merge and
host menus.

menus.png and windows.png are master's here. Both documents now draw the Windows menu (menus.ari
after Help; windows.ari, whose closable window gives it a bar, with every window below that bar),
so both goldens need regenerating under llvmpipe.
The Windows menu now draws in both pictures: after Help in menus, and
as the only menu in windows' bar, with every window below it. Both are
the llvmpipe renders from CI (run 40729298897, the
ari-golden-Linux-libcvc-release artifact), as CVC_UPDATE_GOLDEN=1
writes them under the reference renderer (ARIADNE.md section 12).
@transfix
transfix merged commit 2b7672f into master Oct 29, 2026
24 checks passed
@transfix
transfix deleted the fix/ariadne-window-autofit branch October 29, 2026 20:53
transfix added a commit that referenced this pull request Oct 29, 2026
The project version and the cvcpkg recipe family move to 3.7.4. Every recipe is at cvc_revision 1
already, so none restarts.

3.7.4 carries the whole plant ledger on every plant (#876): plant_sample's vehicle
contact and what each plant measures, the dynamic plants' building and vehicle contacts and
attitude, nav_stats' vehicle_hits, cvc/nav/plant_ledger.h, and publish_nav_stats writing every
item, n/a where a plant does not measure it. demo3's Ledger screen (CVC-DBG/cvcdbg#256) reads it.
It also carries SDL3 owning cvcGL's onscreen window (#829), state_exec's state-incr, state-cas and
state-swap (#860), and Ariadne's window fitting (#828) and room relay test counting (#867).
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.

1 participant