WebPanel: stay shown over the game until closed #14

Open
AwfulWaffle wants to merge 3 commits from AwfulWaffle/RynthCore:webpanel-persist into main
First-time contributor

The in-game web panel disappeared whenever the player clicked anything but the panel: another program, or the game itself. This keeps it up until it is explicitly closed.

What changes

  • Visibility no longer depends on the foreground window. WebPanelWindowPolicy.Visible is now open, game alive, not iconic, game visible. The panel still goes away on X, Escape, Alt+F4, CloseWebPanel, /rc webpanel close, the game window going away, or the game being minimized.
  • The panel is kept directly above the game in the z-order (KeepAboveGame, replacing RaiseAboveGame). It goes over the game, and under any window the player brings over the game, so it never covers another program. When finding that slot, the game's owned windows (RynthCore bar, floating panels) count as part of the game, so the panel stays over them as before. The panel's own dialogs count as part of the panel, matched by root owner.
  • Raising over the foreground game. Probed in game: while acclient is the foreground window, SetWindowPos(HWND_TOP) puts no window over it, not even a new window from another process. The call returns TRUE and nothing moves. HWND_TOPMOST followed by HWND_NOTOPMOST (both SWP_NOACTIVATE) does put the panel over it, and the game keeps the foreground. This is used only when no other program's window is above the game, and never for a topmost game. It logs once, and backs off to about once a second if it keeps failing.
  • Show() sets the z-slot before the first show, so opening from a plugin while the player is in another program does not put the panel over that program.

Tested

  • dotnet build src/RynthCore.Engine -c Release: 0 errors. tools/WebPanelTests: PASS, 151 assertions; the Visibility case is updated for the new rule.
  • In game, on the same change built over a local engine: the panel stays up when clicking the game and other programs, sits under other programs, and the game keeps focus when clicked back into from behind another window.
  • Not run: tools/WebPanelHarness. Its payload csproj does not build on main as it stands, because it never links WebPanelBrowserGate.cs. That is unrelated to this change.

Known behaviour

  • The panel is unowned (by design, so it does not attach to the game's input queue). When the game is clicked, the panel catches up on the foreground WinEvent or the 50 ms timer, so it can blink briefly.

🤖 Generated with Claude Code

The in-game web panel disappeared whenever the player clicked anything but the panel: another program, or the game itself. This keeps it up until it is explicitly closed. ## What changes - **Visibility no longer depends on the foreground window.** `WebPanelWindowPolicy.Visible` is now open, game alive, not iconic, game visible. The panel still goes away on X, Escape, Alt+F4, `CloseWebPanel`, `/rc webpanel close`, the game window going away, or the game being minimized. - **The panel is kept directly above the game in the z-order** (`KeepAboveGame`, replacing `RaiseAboveGame`). It goes over the game, and under any window the player brings over the game, so it never covers another program. When finding that slot, the game's owned windows (RynthCore bar, floating panels) count as part of the game, so the panel stays over them as before. The panel's own dialogs count as part of the panel, matched by root owner. - **Raising over the foreground game.** Probed in game: while acclient is the foreground window, `SetWindowPos(HWND_TOP)` puts no window over it, not even a new window from another process. The call returns TRUE and nothing moves. `HWND_TOPMOST` followed by `HWND_NOTOPMOST` (both `SWP_NOACTIVATE`) does put the panel over it, and the game keeps the foreground. This is used only when no other program's window is above the game, and never for a topmost game. It logs once, and backs off to about once a second if it keeps failing. - `Show()` sets the z-slot before the first show, so opening from a plugin while the player is in another program does not put the panel over that program. ## Tested - `dotnet build src/RynthCore.Engine -c Release`: 0 errors. `tools/WebPanelTests`: PASS, 151 assertions; the `Visibility` case is updated for the new rule. - In game, on the same change built over a local engine: the panel stays up when clicking the game and other programs, sits under other programs, and the game keeps focus when clicked back into from behind another window. - Not run: `tools/WebPanelHarness`. Its payload csproj does not build on main as it stands, because it never links `WebPanelBrowserGate.cs`. That is unrelated to this change. ## Known behaviour - The panel is unowned (by design, so it does not attach to the game's input queue). When the game is clicked, the panel catches up on the foreground WinEvent or the 50 ms timer, so it can blink briefly. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The panel hid whenever the foreground window left the game process, so a
click on another program (and, reportedly, in the game) made it vanish.
It now stays shown while the game window is shown and not minimized, and
is kept directly above the game in the z-order: over the game, under any
window the player brings over the game, so it never covers another program.
Closing it (X, Escape, Alt+F4, the plugin, /rc webpanel close) is still
the only way it goes away while the game shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups: count game-owned windows (RynthCore bar, floating
panels) and the panel's own dialogs, by root owner, as part of the game
and the panel when finding the slot; set the z-slot before the first
show; at the top of the normal band, accept only topmost windows above
the panel, so a topmost game-owned window cannot leave the panel over
another program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While the game is the foreground window, SetWindowPos(HWND_TOP) puts no
window over it, not even a new window of another process (probed in game).
The panel then stayed behind the game after every click on the game.
HWND_TOPMOST then HWND_NOTOPMOST (both NOACTIVATE) does put it over the
game, and the game keeps the foreground. Use that only at the top of the
normal band (no other program's window above the game), so it never
covers another program; skip a topmost game; back off if it keeps failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

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-webpanel-persist
git switch AwfulWaffle-webpanel-persist
git rebase main
git switch main
git merge --ff-only AwfulWaffle-webpanel-persist
git switch AwfulWaffle-webpanel-persist
git rebase main
git switch main
git merge --no-ff AwfulWaffle-webpanel-persist
git switch main
git merge --squash AwfulWaffle-webpanel-persist
git switch main
git merge --ff-only AwfulWaffle-webpanel-persist
git switch main
git merge AwfulWaffle-webpanel-persist
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!14
No description provided.