[PR #6010] [MERGED] feat(mods): raw mouse button pre/post hooks #6606

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

📋 Pull Request Information

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

Base: main ← Head: native/mouse-button-events


📝 Commits (1)

  • 0190d09 feat(mods): raw mouse button pre and post events

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game.rs (+24 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+15 -0)
➕ tests/test_mouse_button_events.py (+73 -0)
➕ tools/native-hook-fragments/mouse_button_events.json (+19 -0)

📄 Description

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

What and why

Fixes #6007; part of #4953's InputEvent additions. native_mouse_button_pre(button, pressed, modifiers, canceled) runs before normal button dispatch on any screen. Canceling skips dispatch and Post. Accepted events call native_mouse_button_post after handling, including screen early returns. Buttons/modifiers use the existing GLFW encoding.

Physical-button tracking remains before cancellation; foreign windows and synthetic pad/focus clicks do not fire hooks. Existing screen-specific pre hooks and legacy native_key notifications retain their behavior. A thin outer dispatcher keeps Post outside the existing handler's early returns without rewriting its routing.

Kind

  • feature: something new for players

Vanilla reference

Read pinned 26.3 MouseHandler.onButton bytecode. Public contracts: InputEvent.MouseButton.Pre and Post. No game files included.

Other projects' code

None; public event documentation only.

Self-check

Client all-target Clippy -D warnings passed. Actual raw dispatch/bookkeeping compiled/executed with fake handlers for normal/early-return processing, cancellation, press/release, synthetic exclusion and unrelated events. Nearby input-capture and hand-render regressions, 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/6010 **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/mouse-button-events` --- ### 📝 Commits (1) - [`0190d09`](https://github.com/horizon-rust/horizon/commit/0190d098d6e6fd2f21d1d99e9c5558dc6717f679) feat(mods): raw mouse button pre and post events ### 📊 Changes **4 files changed** (+131 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+24 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+15 -0) ➕ `tests/test_mouse_button_events.py` (+73 -0) ➕ `tools/native-hook-fragments/mouse_button_events.json` (+19 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally. ## What and why Fixes #6007; part of #4953's InputEvent additions. `native_mouse_button_pre(button, pressed, modifiers, canceled)` runs before normal button dispatch on any screen. Canceling skips dispatch and Post. Accepted events call `native_mouse_button_post` after handling, including screen early returns. Buttons/modifiers use the existing GLFW encoding. Physical-button tracking remains before cancellation; foreign windows and synthetic pad/focus clicks do not fire hooks. Existing screen-specific pre hooks and legacy native_key notifications retain their behavior. A thin outer dispatcher keeps Post outside the existing handler's early returns without rewriting its routing. ## Kind - [x] feature: something new for players ## Vanilla reference Read pinned 26.3 MouseHandler.onButton bytecode. Public contracts: [InputEvent.MouseButton.Pre](https://aldak0.ru/javadoc/26.3.x/net/neoforged/neoforge/client/event/InputEvent.MouseButton.Pre.html) and Post. No game files included. ## Other projects' code None; public event documentation only. ## Self-check Client all-target Clippy -D warnings passed. Actual raw dispatch/bookkeeping compiled/executed with fake handlers for normal/early-return processing, cancellation, press/release, synthetic exclusion and unrelated events. Nearby input-capture and hand-render regressions, 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:42 +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#6606
No description provided.