[PR #4139] [MERGED] Keep latched toggle sprint and sneak across a short focus loss #5438

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4139
Author: @DUzzL
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/issue-4133-toggle-sprint-alt-tab


📝 Commits (1)

  • 77738c6 Keep latched sneak and sprint across a short focus loss

📊 Changes

1 file changed (+5 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -0)

📄 Description

🤖 Opened by DUzzL's AI agent, not by DUzzL personally.

Fixes #4133

Cause: WindowEvent::Focused(false) in game.rs clears self.keys. That also removes the Ctrl and Shift entries synthesised from the latched sprint and sneak toggles. A short alt-tab (under 500 ms) opens no pause screen, so nothing restores them, and the latched sprint drops.

Change: after the clear, sync_toggle(0) and sync_toggle(1) put the latched state back. sync_toggle only inserts or removes based on the toggle state, so it is idempotent. Behaviour while the window keeps focus is unchanged. The pause-menu path is not made worse.

Tested: cargo fmt --check and cargo clippy -p horizon-client --all-targets -- -D warnings pass. cargo test -p horizon-client --bins passes (196 and 18; 3 ignored). No test covers the focus path, none was added. A code-level review of the focus and pause paths found no defect.

Not tested: no in-game or Linux/Hyprland run, so the alt-tab behaviour is not confirmed. The pause-menu path (focus lost for over 500 ms) is not run. No vanilla parity run (no .local vanilla data here). tools/pr_ready.py not run.


🔄 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/4139 **Author:** [@DUzzL](https://github.com/DUzzL) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/issue-4133-toggle-sprint-alt-tab` --- ### 📝 Commits (1) - [`77738c6`](https://github.com/horizon-rust/horizon/commit/77738c63560a0aa868c83ceca76f3118b288b498) Keep latched sneak and sprint across a short focus loss ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -0) </details> ### 📄 Description > 🤖 Opened by DUzzL's AI agent, not by DUzzL personally. Fixes #4133 **Cause:** `WindowEvent::Focused(false)` in `game.rs` clears `self.keys`. That also removes the Ctrl and Shift entries synthesised from the latched sprint and sneak toggles. A short alt-tab (under 500 ms) opens no pause screen, so nothing restores them, and the latched sprint drops. **Change:** after the clear, `sync_toggle(0)` and `sync_toggle(1)` put the latched state back. `sync_toggle` only inserts or removes based on the toggle state, so it is idempotent. Behaviour while the window keeps focus is unchanged. The pause-menu path is not made worse. **Tested:** `cargo fmt --check` and `cargo clippy -p horizon-client --all-targets -- -D warnings` pass. `cargo test -p horizon-client --bins` passes (196 and 18; 3 ignored). No test covers the focus path, none was added. A code-level review of the focus and pause paths found no defect. **Not tested:** no in-game or Linux/Hyprland run, so the alt-tab behaviour is not confirmed. The pause-menu path (focus lost for over 500 ms) is not run. No vanilla parity run (no `.local` vanilla data here). `tools/pr_ready.py` not run. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:35 +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#5438
No description provided.