[PR #1914] [MERGED] Mods ui: recapture the mouse when a mod's screen vanishes, borrow its widgets #3860

Closed
opened 2026-11-03 04:12:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1914
Author: @socksprox
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/mod-ui-screen-capture


📝 Commits (1)

  • 74e3b0a ui: recapture the mouse when a mod's screen vanishes, borrow its widgets

📊 Changes

1 file changed (+44 additions, -43 deletions)

View changed files

📝 crates/horizon-client/src/game/mods.rs (+44 -43)

📄 Description

🤖 Opened by socksprox's AI agent (Devin), not by socksprox.

What and why

The two follow-up notes from the merged #1864's review:

  • Mouse stays free when a mod's screen dies under it. When a mod stopped (or cleared its settings page) while its surface was open, draw_mod_screen dropped straight to Playing without capture(true) — the cursor stayed free until the next click into the world. The dead surface now leaves through close_mod_screen(false), which restores the screen it covered (back to Options > Mods for a settings page) and re-captures the mouse on a return to Playing. The same applies to a screen dropped while it was up. No closed event: the mod ended it, matching close-screen.
  • mod_ui_view cloned per frame. The title and every widget (up to 64 widgets, lists to 512 rows) were cloned on each frame, click and scroll. It now borrows the mod's stored widgets; the screen's scrolls live in a disjoint field, and the click resolves the picked row before the &mut ui_select call.

The third note (widgets-only, no free drawing) stays out of scope, as the review said.

Self-check

cargo fmt --check; cargo check -p horizon-client --bins with and without --features mods; cargo clippy -p horizon-client --features mods --bins -- -D warnings; cargo test -p horizon-mods --features runtime,pack --test sandbox (13 pass).

🤖 Generated with Devin


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1914 **Author:** [@socksprox](https://github.com/socksprox) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/mod-ui-screen-capture` --- ### 📝 Commits (1) - [`74e3b0a`](https://github.com/horizon-rust/horizon/commit/74e3b0adf6937575dd5c5a3d2ea99ed0cb490eec) ui: recapture the mouse when a mod's screen vanishes, borrow its widgets ### 📊 Changes **1 file changed** (+44 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/mods.rs` (+44 -43) </details> ### 📄 Description > 🤖 Opened by socksprox's AI agent (Devin), not by socksprox. ## What and why The two follow-up notes from the merged #1864's [review](https://github.com/ludovic111/horizon/pull/1864#issuecomment-6402444272): - **Mouse stays free when a mod's screen dies under it.** When a mod stopped (or cleared its settings page) while its surface was open, `draw_mod_screen` dropped straight to `Playing` without `capture(true)` — the cursor stayed free until the next click into the world. The dead surface now leaves through `close_mod_screen(false)`, which restores the screen it covered (back to Options > Mods for a settings page) and re-captures the mouse on a return to Playing. The same applies to a screen dropped while it was up. No `closed` event: the mod ended it, matching `close-screen`. - **`mod_ui_view` cloned per frame.** The title and every widget (up to 64 widgets, lists to 512 rows) were cloned on each frame, click and scroll. It now borrows the mod's stored widgets; the screen's scrolls live in a disjoint field, and the click resolves the picked row before the `&mut` `ui_select` call. The third note (widgets-only, no free drawing) stays out of scope, as the review said. ## Self-check `cargo fmt --check`; `cargo check -p horizon-client --bins` with and without `--features mods`; `cargo clippy -p horizon-client --features mods --bins -- -D warnings`; `cargo test -p horizon-mods --features runtime,pack --test sandbox` (13 pass). 🤖 Generated with Devin --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:51 +07:00
Sign in to join this conversation.
No milestone
No project
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
horizon-rust/horizon#3860
No description provided.