[PR #6023] [MERGED] feat(mods): complete window keyboard input hook #6611

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

📋 Pull Request Information

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

Base: main ← Head: native/input-key-events


📝 Commits (2)

  • 906567c feat(mods): complete window keyboard input event
  • 027d02a Merge upstream/main into native/input-key-events

📊 Changes

4 files changed (+102 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+14 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+6 -0)
➕ tests/test_input_key_hook.py (+70 -0)
➕ tools/native-hook-fragments/input_key.json (+12 -0)

📄 Description

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

What and why

Fixes #6022; part of #4953. native_input_key(event, modifiers) receives the original winit KeyEvent after real window keyboard handling, including repeats and shortcut/screen early returns. It exposes physical/logical key, text, location, state and repeat, with existing GLFW modifier bits captured before dispatch. Noncancellable.

Only this game's real window events fire it; OS synthetic focus events and foreign windows do not. This is the OS-window callback: pad/focus/control-socket input retains its existing native_key route. The legacy native_key hook is unchanged. Capturing a single event before dispatch preserves fields the normal handler remaps or consumes.

Kind

  • feature: something new for players

Vanilla reference

Read pinned26.3 KeyboardHandler.keyPress bytecode and its screen/global-key routing. Public contract: InputEvent.Key. Horizon uses winit KeyEvent rather than Java/SDL KeyEvent. No game files included.

Other projects' code

None; public event documentation only.

Self-check

Client all-target Clippy -D warnings passed. Actual window callback compiled/executed with fake normal/early-return handlers: press/release/repeat, original event fields, pre-dispatch modifiers, after-handling order, synthetic/foreign/no-window gates and non-key events. Four fragment tests, formatting, 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/6023 **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/input-key-events` --- ### 📝 Commits (2) - [`906567c`](https://github.com/horizon-rust/horizon/commit/906567c48d5da32c483eac227e798d657e7c1574) feat(mods): complete window keyboard input event - [`027d02a`](https://github.com/horizon-rust/horizon/commit/027d02a8b00e762507298f22ecc5f94613bb877c) Merge upstream/main into native/input-key-events ### 📊 Changes **4 files changed** (+102 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+14 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+6 -0) ➕ `tests/test_input_key_hook.py` (+70 -0) ➕ `tools/native-hook-fragments/input_key.json` (+12 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally. ## What and why Fixes #6022; part of #4953. `native_input_key(event, modifiers)` receives the original winit KeyEvent after real window keyboard handling, including repeats and shortcut/screen early returns. It exposes physical/logical key, text, location, state and repeat, with existing GLFW modifier bits captured before dispatch. Noncancellable. Only this game's real window events fire it; OS synthetic focus events and foreign windows do not. This is the OS-window callback: pad/focus/control-socket input retains its existing native_key route. The legacy native_key hook is unchanged. Capturing a single event before dispatch preserves fields the normal handler remaps or consumes. ## Kind - [x] feature: something new for players ## Vanilla reference Read pinned26.3 KeyboardHandler.keyPress bytecode and its screen/global-key routing. Public contract: [InputEvent.Key](https://aldak0.ru/javadoc/26.3.x/net/neoforged/neoforge/client/event/InputEvent.Key.html). Horizon uses winit KeyEvent rather than Java/SDL KeyEvent. No game files included. ## Other projects' code None; public event documentation only. ## Self-check Client all-target Clippy -D warnings passed. Actual window callback compiled/executed with fake normal/early-return handlers: press/release/repeat, original event fields, pre-dispatch modifiers, after-handling order, synthetic/foreign/no-window gates and non-key events. Four fragment tests, formatting, 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:45 +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#6611
No description provided.