Bar icon dropdown: barMenu on plugin windows (API v95) #13

Open
AwfulWaffle wants to merge 26 commits from AwfulWaffle/RynthCore:bar-menu into main
First-time contributor

Stack (apply in order): RynthCore #12, RynthCore #13, RynthServers #1, RynthServers #2, RynthServers #3, RynthServers #4. RynthCore first; the RynthServers PRs build against it.

Stacks on the web panel PR (pr/web-panel): review/apply that first. The bar menu itself does not use the web panel; the stack is only for the API numbering.

What this adds

A plugin window's bar icon can carry a hover dropdown. The window's entry in the sections manifest gains an optional "barMenu": up to 6 items { "id", "tooltip", "icon", "command" }. Hovering the bar icon for 0.15 s drops a column of icon buttons straight below it (above, if there is no room). It stays while the mouse is over the icon or the column, and for 0.30 s after it leaves both. Clicking an item runs its command as a player chat command (the hotkey path). Clicking the bar icon itself still toggles the window.

DreamWeave uses it for its website links (Market, Suit Builder, Ability Planner on the DreamWeave icon).

  • Validated like the rest of the manifest, with the window always kept: the id is a short lower-case word, unique in the menu; the tooltip is capped at 48 characters; the command must be a single /... chat command (the contribution rule); the icon is one Phosphor glyph, else the tooltip's first letter. A bad item is dropped; items past 6 are ignored.
  • Plugin API v95 (PluginContractVersion.BarMenu), no function table change. Engines before v95 ignore the key, so a plugin can declare it unconditionally and check Host.Version to decide whether it still needs its own buttons.
  • Works on the docked and the popped-out bar. The pop-out has its own ImGui context and clock, so the hover timer resets on a clock jump or a gap over 0.5 s.
  • The dropdown is brought to the display front each frame (cimgui igBringWindowToDisplayFront, no focus change), so a focused panel does not cover it.
  • A reload that changes only barMenu reaches the bar without re-registering the panel (WindowPlan.MenuSignature).
  • Hover timing is pure (ImGui/BarMenuHover.cs) and unit-tested. Changelog/2026-11-07-bar-menu.md has the detail.

How it was tested

On this branch:

tools\PluginManifestTests          PASS (355 assertions); -a x86: PASS (361 assertions)
tools\SectionsTests                223/223 checks passed (ManifestBarMenu, BarMenuHoverTiming, BarMenuReload)
tools\WebPanelTests                PASS (147 assertions)
tools\ChatCommandReplyTests        744/744 checks passed
tools\EngineSettingsTests          PASS (1583 assertions)

In game, on DreamWeave stage with the DreamWeave plugin: the dropdown opens on hover, stays while moving into it, and lines up under the icon. Each item opens its page, and the icon's click still opens the card.

Rebase note

This was built on 418d80b and rebased onto 2026.11.8.1. The changes from that are UnderUi before BarMenu in SectionWindowDecl, and the renumber from 94 to 95, which is its own commit at the tip.

🤖 Generated with Claude Code

Stack (apply in order): RynthCore #12, RynthCore #13, RynthServers #1, RynthServers #2, RynthServers #3, RynthServers #4. RynthCore first; the RynthServers PRs build against it. Stacks on the web panel PR (pr/web-panel): review/apply that first. The bar menu itself does not use the web panel; the stack is only for the API numbering. ## What this adds A plugin window's bar icon can carry a hover dropdown. The window's entry in the sections manifest gains an optional `"barMenu"`: up to 6 items `{ "id", "tooltip", "icon", "command" }`. Hovering the bar icon for 0.15 s drops a column of icon buttons straight below it (above, if there is no room). It stays while the mouse is over the icon or the column, and for 0.30 s after it leaves both. Clicking an item runs its command as a player chat command (the hotkey path). Clicking the bar icon itself still toggles the window. DreamWeave uses it for its website links (Market, Suit Builder, Ability Planner on the DreamWeave icon). - Validated like the rest of the manifest, with the window always kept: the id is a short lower-case word, unique in the menu; the tooltip is capped at 48 characters; the command must be a single `/...` chat command (the contribution rule); the icon is one Phosphor glyph, else the tooltip's first letter. A bad item is dropped; items past 6 are ignored. - Plugin API **v95** (`PluginContractVersion.BarMenu`), no function table change. Engines before v95 ignore the key, so a plugin can declare it unconditionally and check `Host.Version` to decide whether it still needs its own buttons. - Works on the docked and the popped-out bar. The pop-out has its own ImGui context and clock, so the hover timer resets on a clock jump or a gap over 0.5 s. - The dropdown is brought to the display front each frame (cimgui `igBringWindowToDisplayFront`, no focus change), so a focused panel does not cover it. - A reload that changes only `barMenu` reaches the bar without re-registering the panel (`WindowPlan.MenuSignature`). - Hover timing is pure (`ImGui/BarMenuHover.cs`) and unit-tested. `Changelog/2026-11-07-bar-menu.md` has the detail. ## How it was tested On this branch: ``` tools\PluginManifestTests PASS (355 assertions); -a x86: PASS (361 assertions) tools\SectionsTests 223/223 checks passed (ManifestBarMenu, BarMenuHoverTiming, BarMenuReload) tools\WebPanelTests PASS (147 assertions) tools\ChatCommandReplyTests 744/744 checks passed tools\EngineSettingsTests PASS (1583 assertions) ``` In game, on DreamWeave stage with the DreamWeave plugin: the dropdown opens on hover, stays while moving into it, and lines up under the icon. Each item opens its page, and the icon's click still opens the card. ## Rebase note This was built on 418d80b and rebased onto 2026.11.8.1. The changes from that are `UnderUi` before `BarMenu` in `SectionWindowDecl`, and the renumber from 94 to 95, which is its own commit at the tip. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pure C# policies (allowlist/redaction, visibility/layout, profile folder) plus tools/WebPanelTests (107 assertions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Uri.IdnHost throws UriFormatException for hosts like c<U+2100>; catch and reject. Test project now runs with ICU so the case is covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches the shipped engine; the surrogate host discriminates the IdnHost try/catch under invariant mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four appended table slots (WebPanelOpen/Navigate/Close/GetState), native structs and code enums in engine and SDK, a WebPanelApi stub answering Unavailable (CoreCLR flavour only; AOT leaves the slots zero), SDK OpenWebPanel/NavigateWebPanel/CloseWebPanel/GetWebPanelState with HasWebPanel gated on Version >= 93, parity tests in PluginManifestTests. Also adds the missing System usings to the Task 1 WebPanel files, which did not compile in the engine project (no ImplicitUsings).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebPanelStructsMatch now asserts 48 bytes / Reserved at 32 on x86 for engine and SDK types when run 32-bit. PluginContract.cs v93 divider was double-encoded (cp1252 read of UTF-8); restored to box-drawing chars.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebPanelHost (CoreCLR engine only): one unowned WS_POPUP over the game client area on its own STA thread and GetMessage loop, lifted from the 2026-11-07 spike's popup-free path. Open/Navigate/Close/GetState never block: they validate, update the caller-visible state under a lock, queue work and post WM_APP+1 to the host window. WebView2Loader.dll is loaded by full path from the shim's Runtime folder; the runtime probe on the panel thread decides RuntimeMissing, any later creation failure is CreateFailed. Navigation guard (NavigationStarting incl. redirects, NewWindowRequested, LaunchingExternalUriScheme): off-list http/https goes to the system browser, anything else is dropped; logs carry only Redact()ed URLs or hosts. Escape via AcceleratorKeyPressed unless PageKeepsEscape. Visibility by the PID rule on a 50 ms timer plus a foreground WinEvent; raises only when below the game; layout remembered in layout.json. Shutdown unhooks, closes the controller, destroys the window and unregisters the class before the collectible context unloads.

WebPanelNativeArgs copies every string out of the caller's (stack or pooled) buffers before anything is queued. WebPanelApi is the ABI glue (AOT keeps the Unavailable stub). engine.json "WebPanel" (default true) is the kill switch. EngineLifecycle shuts the panel down after EndSceneHook.Uninstall. The WebView2 package's WinForms/WPF references are dropped before reference resolution.

Deviations from the brief: IWebPanelEnvironment gains BrowserExecutableFolderForTests (the harness forces a creation failure with it) and is excluded from the AOT build with the host; Show only takes the foreground when it is already in this process (or none).

tools\WebPanelHarness (x86 exe) + tools\WebPanelHarness.Payload: fake game thread, fake 16 ms pump, collectible context mirroring EngineLoadContext, local virtual hosts, posted input only. 17 ok, 0 FAIL, 4 UNVERIFIED offline (Escape via posted input never raises AcceleratorKeyPressed; visibility needs the foreground): owner in-game checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ProcessFailed: only BrowserProcessExited (teardown) and RenderProcessExited (about:blank, recreate on the next Open) fail the panel, as WebView2's docs describe the kinds; GPU, utility, sandbox, PPAPI and frame-only renderer exits are logged only. RenderProcessUnresponsive fails it at 3 reports within 30 s. The handler acts on the panel being served now.
- Fail decides "ignored" under the lock first and hides the panel only when the failure is live: a late failure for a superseded handle no longer hides the newer panel.
- The panel thread's finally restarts the thread when an Open is still queued and the host is not shutting down; _threadDone goes false only after StartStaThread returns.
- Show takes the foreground only when a window of this process (or of this panel's WebView2 browser process) holds it, never while the foreground is null. The visibility rule counts the browser process (CoreWebView2.BrowserProcessId) as ours, so the page's own dialogs do not hide the panel.
- ClipboardRead is allowed only for an allowlisted origin. NavigationStarting and NewWindowRequested fail closed on an exception.
- WebPanelApiRules: the ABI glue's pure parts (refusals, GetState Size check, state write), tested in WebPanelTests with WebPanelNativeArgs. WebPanelApi.LiveHandle and the browser pid in Describe for Task 4.
- Harness: GpuProcessCrashKeepsPanel and LateFailureForSupersededHandle (both RED before the fix), UnloadWhileVisibleCollected reports UNVERIFIED when the window was not visible, the game-side key count is informational. EngineSettingsTests: WebPanel default-on round trip and setter case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Reset the unresponsive counter on teardown, on each new open and on
  navigation completed; harness check UnresponsiveCountResetsPerOpen.
- Show only calls SetForegroundWindow when our process holds the foreground.
- ClipboardRead permission is denied for about:blank.
- Open rolls back live handle and status fields if the STA thread fails to start.
- State struct minimum size is 28 on both platforms; test asserts it unguarded.
- Harness Escape message reports game key count as informational.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Status prints one redacted line (WebPanelApi.Describe plus the address space);
close closes the live panel. Neither opens a URL. WebPanelHost.Describe now
reports visible/focused/in-browser instead of raw flags; the stacked test-hook
summaries are put back on their own members. ChatCommandReplyTests covers the verb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build-Installer.ps1 now requires Runtime\Microsoft.Web.WebView2.Core.dll and
Runtime\WebView2Loader.dll in a CoreCLR staging tree. THIRD-PARTY-NOTICES.md
gains the Microsoft WebView2 SDK entry with the licence copied from the package's
LICENSE.txt. A scratch EngineOnly publish put both DLLs at the target root, the
loader is x86 (0x14C), and no runtimes\ folder or WinForms/Wpf DLL is present, so
no csproj change was needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- RynthCoreChatCommands: each method keeps its own summary; /rc webpanel close answers by the Close code (closing / already closed / could not close); verb added to the class header list.
- Build-Installer.ps1: Assert-PeMachine throws unless Runtime\WebView2Loader.dll is x86 (0x14C).
- ChatCommandReplyTests: HandleWebPanelCommand has no Open(, Navigate( or ShellExecute.
- Engine csproj: Microsoft.Web.WebView2.Core.xml is not copied (with the other dropped WebView2 copies).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plugin contract (docs/WEB_PANEL.md) and changelog for the v93 web panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Creation-failure fallback sets OpenedInBrowser and says "opened" only
  when the system browser actually opened; otherwise chat says the
  browser did not open. Harness check CreateFailureBrowserFails.
- FocusPage follows the same in-process foreground rule as
  SetForegroundWindow (Show and controller creation). Harness check
  NoFocusFromAnotherProcess; posted-key checks report UNVERIFIED when
  another process holds the foreground.
- PermissionRequested: SavesInProfile = false.
- WEB_PANEL.md: allowlist empty-entry rule, GetState -4, AOT renumber
  caveat, softened focus claim (also in the Changelog).
- Formatting: ChatCommandReplyTests brace, /rc layout comment,
  PluginContract blank line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plugin polling between Failed and OpenedInBrowser saw Failed with no
flag and, per the docs, opened the page itself: a second open with a
spent code. While the fallback is pending the status keeps its
pre-failure value; after OpenInBrowser (outside the lock) one lock sets
Failed, the error and, when the browser opened, the flag. The
no-fallback path is unchanged. Harness: OpenInBrowser delay mode and a
continuous poll in CreateFailureFallsBack. Show comments reworded as
defensive, not observed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream release 2026.11.8.1 took v93 for GetMonsterHealth. The web panel's four slots now follow
GetMonsterHealthFn in the engine table and the SDK's RynthCoreApiNative, and the web panel is v94:
PluginContractVersion.Current, RynthCoreSdkApiVersion, HasWebPanel (Version >= 94), the comments,
docs/WEB_PANEL.md, the changelog and PluginManifestTests (HasWebPanel version cases, slot names).
Still provisional: unmerged upstream branches also use 94.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BarMenuHover (pure timer: 0.15 s open, 0.30 s close, switch at once, no reopen after a click until the icon is left), the dropdown drawn under the bar icon, and a barMenu-only plugin reload now reaches the bar (WindowPlan.MenuSignature, refreshed in PluginWindows.Sync without re-registering the panel).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hover timer resets on a backwards clock (pop-out's own ImGui context) or a frame gap over 0.5 s; the guard is pure and tested. The dropdown's letter fallback uses the same helper as IconFor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring the dropdown to the display front each frame (igBringWindowToDisplayFront,
no focus change), reply in chat when the command queue is full, add
PluginContractVersion.BarMenu for plugins to pin against, drop a redundant Trim,
point a comment at the SectionManifest header, and list all bar menu tests
in the changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window's left edge sat on the icon's left edge, so its padding pushed the
icons right of the parent. Centre the window on the icon instead (still clamped
to the viewport).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Centring on the assumed 4 * s padding overshot: the owner saw the icons about as far
left as they had been right. Measure where the first icon actually starts inside the
menu window each frame and place the window so that point sits on the parent icon's
left edge (4 * s until the first measure).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pixel scan of the owner's screenshots showed the applied inset is the pushed
4 * s padding after all (+6 px before centring, -1 px after); the residual pixel is
ImGui truncating the window position. Drop the measured inset and set each icon's
x to the intended position (parent's left edge, or the clamped spot) before drawing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream took v93 (GetMonsterHealth) and the web panel is now v94, so the "barMenu" manifest key is
v95: PluginContractVersion.BarMenu and Current, RynthCoreSdkApiVersion, the comments in
SectionManifest.cs, ImGuiBar.cs and BarMenuHover.cs, the SectionsTests case names and the changelog.
docs/WEB_PANEL.md names the SDK's API as 95 now. No table change. Still provisional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This pull request has changes conflicting with the target branch.
  • src/RynthCore.Engine/Plugins/PluginContract.cs
  • src/RynthCore.Engine/Plugins/PluginContractVersion.cs
  • src/RynthCore.Engine/Plugins/PluginManager.cs
  • src/RynthCore.Engine/WebPanel/WebPanelHost.cs
  • src/RynthCore.Engine/WebPanel/WebPanelNative.cs
  • src/RynthCore.Engine/WebPanel/WebPanelWindowPolicy.cs
  • src/RynthCore.PluginSdk/RynthCoreApiNative.cs
  • src/RynthCore.PluginSdk/RynthCoreHost.cs
  • src/RynthCore.PluginSdk/build/RynthCore.PluginSdk.targets
  • tools/PluginManifestTests/Program.cs
  • tools/WebPanelHarness/Program.cs
  • tools/WebPanelTests/Program.cs
  • tools/WebPanelTests/WebPanelTests.csproj
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u bar-menu:AwfulWaffle-bar-menu
git switch AwfulWaffle-bar-menu

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff AwfulWaffle-bar-menu
git switch AwfulWaffle-bar-menu
git rebase main
git switch main
git merge --ff-only AwfulWaffle-bar-menu
git switch AwfulWaffle-bar-menu
git rebase main
git switch main
git merge --no-ff AwfulWaffle-bar-menu
git switch main
git merge --squash AwfulWaffle-bar-menu
git switch main
git merge --ff-only AwfulWaffle-bar-menu
git switch main
git merge AwfulWaffle-bar-menu
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rynth/RynthCore!13
No description provided.