[PR #6019] [MERGED] feat(mods): screen mouse drag pre hook #6610

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/6019
Author: @Xmilon
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: native/screen-mouse-dragged


📝 Commits (2)

  • 55d67aa feat(mods): screen mouse drag pre event
  • 1ffa50b Merge upstream/main and end a drag on any button release

📊 Changes

5 files changed (+162 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+12 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+41 -0)
📝 crates/horizon-client/src/game/split.rs (+1 -0)
➕ tests/test_screen_mouse_dragged_hook.py (+95 -0)
➕ tools/native-hook-fragments/screen_mouse_dragged.json (+13 -0)

📄 Description

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

What and why

Fixes #6017; part of #4953 / #5543. native_screen_mouse_dragged_pre(screen, button, delta, modifiers, canceled) runs before existing screen drag handlers. The screen view carries the updated GUI pointer position; delta is movement in GUI pixels. Canceling skips screen drag handling while retaining cursor movement.

Track the most recently pressed real button until its matching release. Clear that state on focus loss and splitscreen input handoff; require that the button is still physically held. Hover, zero movement, synthetic input and the existing excluded screens do not fire the hook. Existing no-mod drag routing stays intact.

Kind

  • feature: something new for players

Vanilla reference

Read pinned26.3 MouseHandler.onButton/onMove/handleAccumulatedMovement bytecode, including activeButton and Screen.mouseDragged. Public contract: ScreenEvent.MouseDragged.Pre. No game files included.

Other projects' code

None; public event documentation only.

Self-check

Client all-target Clippy -D warnings passed. Actual tracking/helper/cursor/focus code compiled/executed with a fake mod: latest button selection, unrelated/matching release, GUI scale and successive deltas, cancellation with cursor preservation, hover/stale-button/synthetic/excluded-screen gates and focus reset. 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/6019 **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-mouse-dragged` --- ### 📝 Commits (2) - [`55d67aa`](https://github.com/horizon-rust/horizon/commit/55d67aaa4db274a5abfceaba351a358545d125ac) feat(mods): screen mouse drag pre event - [`1ffa50b`](https://github.com/horizon-rust/horizon/commit/1ffa50bf875f78692261082f2c55a4a166fca920) Merge upstream/main and end a drag on any button release ### 📊 Changes **5 files changed** (+162 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+12 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+41 -0) 📝 `crates/horizon-client/src/game/split.rs` (+1 -0) ➕ `tests/test_screen_mouse_dragged_hook.py` (+95 -0) ➕ `tools/native-hook-fragments/screen_mouse_dragged.json` (+13 -0) </details> ### 📄 Description > 🤖 Opened by Xmilon's AI agent (Codex), not by Xmilon personally. ## What and why Fixes #6017; part of #4953 / #5543. `native_screen_mouse_dragged_pre(screen, button, delta, modifiers, canceled)` runs before existing screen drag handlers. The screen view carries the updated GUI pointer position; delta is movement in GUI pixels. Canceling skips screen drag handling while retaining cursor movement. Track the most recently pressed real button until its matching release. Clear that state on focus loss and splitscreen input handoff; require that the button is still physically held. Hover, zero movement, synthetic input and the existing excluded screens do not fire the hook. Existing no-mod drag routing stays intact. ## Kind - [x] feature: something new for players ## Vanilla reference Read pinned26.3 MouseHandler.onButton/onMove/handleAccumulatedMovement bytecode, including activeButton and Screen.mouseDragged. Public contract: [ScreenEvent.MouseDragged.Pre](https://aldak0.ru/javadoc/26.3.x/net/neoforged/neoforge/client/event/ScreenEvent.MouseDragged.Pre.html). No game files included. ## Other projects' code None; public event documentation only. ## Self-check Client all-target Clippy -D warnings passed. Actual tracking/helper/cursor/focus code compiled/executed with a fake mod: latest button selection, unrelated/matching release, GUI scale and successive deltas, cancellation with cursor preservation, hover/stale-button/synthetic/excluded-screen gates and focus reset. 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#6610
No description provided.