[PR #6014] [MERGED] feat(mods): screen key release pre hook #6608

Closed
opened 2026-11-03 06:23:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6014
Author: @Xmilon
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: native/screen-key-released


📝 Commits (3)

  • f8350d2 feat(mods): screen key release pre event
  • b88289e test(mods): exercise actual mouse mapping release gate
  • 202a24c test(mods): isolate release dispatch from adjacent input hooks

📊 Changes

4 files changed (+179 additions, -32 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+41 -32)
📝 crates/horizon-client/src/game/native_hooks.rs (+27 -0)
➕ tests/test_screen_key_released_hook.py (+98 -0)
➕ tools/native-hook-fragments/screen_key_released.json (+13 -0)

📄 Description

🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally.

What and why

Fixes #6011; part of #4953 / #5543. native_screen_key_released_pre(screen, key, modifiers, canceled) complements the existing screen key-press hook, using the same screen exclusions, named keys and GLFW modifier encoding. It fires only on releases. Cancellation bypasses screen release handling and its legacy native_key notification.

Physical key tracking still runs first. Canceled releases also clear the held key and release every mapped keyboard/toggle binding; mouse mappings retain their gameplay-only gate, so canceling a screen event cannot leave movement or actions stuck. The existing mapping loop is shared with ordinary key dispatch without changing its decisions or error handling.

Kind

  • feature: something new for players

Vanilla reference

Read pinned26.3 KeyboardHandler.keyPress bytecode, including Screen.keyReleased and mapping-release routing. Public contract: ScreenEvent.KeyReleased.Pre. No game files included.

Other projects' code

None; public event documentation only.

Self-check

Client all-target Clippy -D warnings passed. Actual hook gate, cancellation branch and mapping dispatch compiled/executed with fake handlers: cancellation/acceptance, screen exclusion, unnamed/unidentified keys, press exclusion, modifiers and keyboard mapping release and the actual mouse-mapping gameplay/title gate. Nearby input-capture tests and four fragment tests passed; formatting and diff/public-tree checks passed. API fragment only. No game launch/screenshots or full game test suite; CI pending.

🤖 Generated with Codex


🔄 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/6014 **Author:** [@Xmilon](https://github.com/Xmilon) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `native/screen-key-released` --- ### 📝 Commits (3) - [`f8350d2`](https://github.com/horizon-rust/horizon/commit/f8350d2240f573550045c2c40a7d81ef5692ffba) feat(mods): screen key release pre event - [`b88289e`](https://github.com/horizon-rust/horizon/commit/b88289edd18aa3b3e22f4d23e5435e226815cf70) test(mods): exercise actual mouse mapping release gate - [`202a24c`](https://github.com/horizon-rust/horizon/commit/202a24c55341c239ecce2596785abc5d553c167d) test(mods): isolate release dispatch from adjacent input hooks ### 📊 Changes **4 files changed** (+179 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+41 -32) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+27 -0) ➕ `tests/test_screen_key_released_hook.py` (+98 -0) ➕ `tools/native-hook-fragments/screen_key_released.json` (+13 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally. ## What and why Fixes #6011; part of #4953 / #5543. `native_screen_key_released_pre(screen, key, modifiers, canceled)` complements the existing screen key-press hook, using the same screen exclusions, named keys and GLFW modifier encoding. It fires only on releases. Cancellation bypasses screen release handling and its legacy native_key notification. Physical key tracking still runs first. Canceled releases also clear the held key and release every mapped keyboard/toggle binding; mouse mappings retain their gameplay-only gate, so canceling a screen event cannot leave movement or actions stuck. The existing mapping loop is shared with ordinary key dispatch without changing its decisions or error handling. ## Kind - [x] feature: something new for players ## Vanilla reference Read pinned26.3 KeyboardHandler.keyPress bytecode, including Screen.keyReleased and mapping-release routing. Public contract: [ScreenEvent.KeyReleased.Pre](https://aldak0.ru/javadoc/26.3.x/net/neoforged/neoforge/client/event/ScreenEvent.KeyReleased.Pre.html). No game files included. ## Other projects' code None; public event documentation only. ## Self-check Client all-target Clippy -D warnings passed. Actual hook gate, cancellation branch and mapping dispatch compiled/executed with fake handlers: cancellation/acceptance, screen exclusion, unnamed/unidentified keys, press exclusion, modifiers and keyboard mapping release and the actual mouse-mapping gameplay/title gate. Nearby input-capture tests and four fragment tests passed; formatting and diff/public-tree checks passed. API fragment only. No game launch/screenshots or full game test suite; CI pending. 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:23:44 +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#6608
No description provided.