[PR #2052] [MERGED] Container clicks: a closed screen drops its press state #3968

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

📋 Pull Request Information

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

Base: main ← Head: fix/chest-shift-click


📝 Commits (3)

  • 87e3df5 Container clicks: a closed screen drops its press state
  • 78bfe74 Container clicks: the stuck-drag test joins the module's tests
  • f4b4f94 Capture test: the fixture's Game resets its inventory clicks too

📊 Changes

3 files changed (+42 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/container_screen.rs (+26 -0)
📝 crates/horizon-client/src/game.rs (+15 -1)
📝 tests/test_world_input_capture.py (+1 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154.

What and why

#1737 reports that after a few Shift+Right-Click transfers in a (double) chest, clicks stop working everywhere
until the game is restarted. I could not reproduce it on current main, so this PR does not claim to close
it — it removes the one piece of stale state that can produce exactly that symptom.

AbstractContainerScreen keeps isQuickCrafting and the drag it belongs to on the screen. Horizon keeps them on
Game (inv_clicks, inv_drag, last_inv_click) and never cleared them when a screen closed. A press whose
release never reached the screen — the pointer left the window, or the screen closed between press and release —
leaves Clicks::quick_crafting set, and Clicks::press then answers None for every later press on every
later screen: clicks go dead.

Game::reset_inventory_clicks runs when a container closes and when the pointer is grabbed again, which is the
lifetime vanilla gives that state.

Reproduction attempts on main (8cf51888), all in a real game via horizon-ctl

Case Result
Single chest, 8 Shift+Right-Click transfers, then a plain click clicks work
Double chest (54 slots), 9 Shift+Right-Click transfers on nine hotbar slots clicks work
Double chest, 12 rapid Shift+Right-Clicks on one slot clicks work
Six rapid Shift+Left-Clicks (double-click PICKUP_ALL path) clicks work
Shift+Right-Click while carrying a stack clicks work
Crafting table: Shift+Left-Click into the grid, close with Escape, reopen inventory grid returned, clicks work
Press with a stack carried, screen closed with E before the release, reopen clicks work

a_lost_release_does_not_wedge_the_next_screen pins the mechanism the reset prevents: a stuck quick-craft drag
swallows the next press, and a fresh Clicks takes it as a normal click again.

Scope

2 files, +46 (game.rs, container_screen.rs). menu_click and container_screen harnesses pass.

🤖 Generated with [CC].

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, upstream 7ecb43cc, 2 min 21 s)

Check Result
Scope ✅ 2 files, +46 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ❌ failed (8 s)
tests: horizon-client ✅ 1293 passed (2 min 3 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt / clippy / tests ➖ launcher untouched
Parity ➖ 270 affected, to run in CI (--quick)
Label no label for a fix

clippy fails on crates/horizon-client/src/mobs/axolotl.rs:169 (overly_complex_bool_expr), which fails the same way on upstream/main at 7ecb43cc: nothing in this branch touches it.


🔄 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/2052 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/chest-shift-click` --- ### 📝 Commits (3) - [`87e3df5`](https://github.com/horizon-rust/horizon/commit/87e3df5331fe0825545cdb9d141935382ce3ef10) Container clicks: a closed screen drops its press state - [`78bfe74`](https://github.com/horizon-rust/horizon/commit/78bfe7446512fcbf12820b47d168f66d6a4a847d) Container clicks: the stuck-drag test joins the module's tests - [`f4b4f94`](https://github.com/horizon-rust/horizon/commit/f4b4f944e3e4a635d564c000e1c773d4a3d542dc) Capture test: the fixture's Game resets its inventory clicks too ### 📊 Changes **3 files changed** (+42 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/container_screen.rs` (+26 -0) 📝 `crates/horizon-client/src/game.rs` (+15 -1) 📝 `tests/test_world_input_capture.py` (+1 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154. ## What and why #1737 reports that after a few Shift+Right-Click transfers in a (double) chest, clicks stop working everywhere until the game is restarted. **I could not reproduce it on current `main`**, so this PR does not claim to close it — it removes the one piece of stale state that can produce exactly that symptom. `AbstractContainerScreen` keeps `isQuickCrafting` and the drag it belongs to on the screen. Horizon keeps them on `Game` (`inv_clicks`, `inv_drag`, `last_inv_click`) and never cleared them when a screen closed. A press whose release never reached the screen — the pointer left the window, or the screen closed between press and release — leaves `Clicks::quick_crafting` set, and `Clicks::press` then answers `None` for **every** later press on **every** later screen: clicks go dead. `Game::reset_inventory_clicks` runs when a container closes and when the pointer is grabbed again, which is the lifetime vanilla gives that state. ## Reproduction attempts on `main` (8cf51888), all in a real game via `horizon-ctl` | Case | Result | | --- | --- | | Single chest, 8 Shift+Right-Click transfers, then a plain click | clicks work | | Double chest (54 slots), 9 Shift+Right-Click transfers on nine hotbar slots | clicks work | | Double chest, 12 rapid Shift+Right-Clicks on one slot | clicks work | | Six rapid Shift+Left-Clicks (double-click `PICKUP_ALL` path) | clicks work | | Shift+Right-Click while carrying a stack | clicks work | | Crafting table: Shift+Left-Click into the grid, close with Escape, reopen inventory | grid returned, clicks work | | Press with a stack carried, screen closed with `E` before the release, reopen | clicks work | `a_lost_release_does_not_wedge_the_next_screen` pins the mechanism the reset prevents: a stuck quick-craft drag swallows the next press, and a fresh `Clicks` takes it as a normal click again. ## Scope 2 files, +46 (`game.rs`, `container_screen.rs`). `menu_click` and `container_screen` harnesses pass. 🤖 Generated with [[CC]](https://github.com/levzzz5154/horizon). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, upstream 7ecb43cc, 2 min 21 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +46 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ❌ failed (8 s) | | tests: horizon-client | ✅ 1293 passed (2 min 3 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt / clippy / tests | ➖ launcher untouched | | Parity | ➖ 270 affected, to run in CI (--quick) | | Label | no label for a fix | `clippy` fails on `crates/horizon-client/src/mobs/axolotl.rs:169` (`overly_complex_bool_expr`), which fails the same way on `upstream/main` at 7ecb43cc: nothing in this branch touches it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:39 +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#3968
No description provided.