[PR #5616] [MERGED] Native mods: screen_mouse_scrolled, the wheel over the open screen (API next) #6389

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5616
Author: @Sylviromi
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @levzzz5154

Base: main ← Head: screen-mouse-scrolled


📝 Commits (3)

  • b1d6819 Native mods: the screen hears of the wheel before it scrolls
  • c901615 Merge branch 'screen-mouse-button' into screen-mouse-scrolled
  • e69ed14 Merge remote-tracking branch 'origin/main' into screen-mouse-scrolled

📊 Changes

3 files changed (+64 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+21 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+35 -3)
➕ tools/native-hook-fragments/screen_mouse_scrolled.json (+8 -0)

📄 Description

🤖 Opened by Sylviromi's AI agent (Claude Code, claude-sonnet-5-5), not by Sylviromi personally.

Part of #5543 (the wheel). Stacked on #5578: the commits up to the merge of #5578's branch are #5571's and #5578's; this PR's own commit is b1d681973 (plus the merge c90161511 that brings #5578's latest fix forward). Review b1d681973 only; after #5578 merges this diff is ~65 lines.

What and why

Adds native_screen_mouse_scrolled_pre (NeoForge ScreenEvent.MouseScrolled.Pre), so a native mod can take the mouse wheel over an open screen before the game scrolls anything. Signature: (&self, screen: &NativeScreenView, scroll: [f64; 2], modifiers: u32, canceled: &mut bool). Hook API: next.

  • scroll is the wheel's movement in x and y as the game's scroll handler already scales it (a notch is ±1, its sign only, times the wheel sensitivity; a touchpad's pixels are divided by 30). Modifiers are GLFW bits (shift 1, ctrl 2, alt 4, super 8). The pointer is in screen.mouse.
  • Fired in the window's MouseWheel arm, before the dialog, title, hotbar, bundle and every screen scroll, so a cancelled turn scrolls nothing and leaves nothing half-applied. The hotbar reads the wheel only while playing, which the hook's gate excludes.
  • Same gate as the mouse button hooks: Options and the pack list opened from the title screen fire; the title screen itself, connect/loading screens, prompts/books/sign editors over gameplay and a world loading or saving never do. A wheel a gamepad or the keyboard focus sends is not the mouse and fires nothing.
  • Pending fragment: tools/native-hook-fragments/screen_mouse_scrolled.json.

In-game proof

A test native mod cancelled the wheel over the open screen: the scroll hook fired, and a cancel path exists. No screenshot: the hook has no visuals of its own.

Kind

  • feature: something new for players (listed under New in the release notes)

Label: feature

Vanilla reference

NeoForge ScreenEvent.MouseScrolled.Pre, fired from MouseHandler.onScroll before Screen.mouseScrolled. There is no parity harness for this ticket (it adds a hook, no vanilla behaviour changes).

Other projects' code

none

Self-check

Note: the pr_ready run below covers this PR and the next one stacked on it (the key hooks) together, against screen-mouse-button; the scope counts both.

pr_ready (tools/pr_ready.py --quick)

Check Result
Scope ✅ 6 files, +275 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 510 passed
rustfmt ✅
clippy ✅
tests: horizon-client ✅ 1580 passed
doc tests ✅
launcher ➖ launcher untouched
Parity ➖ not run locally: CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

"Allow edits by maintainers" is on (default for fork PRs).

🤖 Generated with Claude Code


🔄 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/5616 **Author:** [@Sylviromi](https://github.com/Sylviromi) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `screen-mouse-scrolled` --- ### 📝 Commits (3) - [`b1d6819`](https://github.com/horizon-rust/horizon/commit/b1d6819737cabae0cda4c11268d1dfc9954cb652) Native mods: the screen hears of the wheel before it scrolls - [`c901615`](https://github.com/horizon-rust/horizon/commit/c90161511b9404e22911a177208490b058d15e0f) Merge branch 'screen-mouse-button' into screen-mouse-scrolled - [`e69ed14`](https://github.com/horizon-rust/horizon/commit/e69ed14ade44bcee980afbb3cc8d3a4c29a13436) Merge remote-tracking branch 'origin/main' into screen-mouse-scrolled ### 📊 Changes **3 files changed** (+64 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+21 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+35 -3) ➕ `tools/native-hook-fragments/screen_mouse_scrolled.json` (+8 -0) </details> ### 📄 Description > 🤖 Opened by Sylviromi's AI agent (Claude Code, claude-sonnet-5-5), not by Sylviromi personally. Part of #5543 (the wheel). Stacked on #5578: the commits up to the merge of #5578's branch are #5571's and #5578's; this PR's own commit is `b1d681973` (plus the merge `c90161511` that brings #5578's latest fix forward). Review `b1d681973` only; after #5578 merges this diff is ~65 lines. ## What and why Adds `native_screen_mouse_scrolled_pre` (NeoForge `ScreenEvent.MouseScrolled.Pre`), so a native mod can take the mouse wheel over an open screen before the game scrolls anything. Signature: `(&self, screen: &NativeScreenView, scroll: [f64; 2], modifiers: u32, canceled: &mut bool)`. Hook API: next. - `scroll` is the wheel's movement in x and y as the game's scroll handler already scales it (a notch is ±1, its sign only, times the wheel sensitivity; a touchpad's pixels are divided by 30). Modifiers are GLFW bits (shift 1, ctrl 2, alt 4, super 8). The pointer is in `screen.mouse`. - Fired in the window's `MouseWheel` arm, before the dialog, title, hotbar, bundle and every screen scroll, so a cancelled turn scrolls nothing and leaves nothing half-applied. The hotbar reads the wheel only while playing, which the hook's gate excludes. - Same gate as the mouse button hooks: Options and the pack list opened from the title screen fire; the title screen itself, connect/loading screens, prompts/books/sign editors over gameplay and a world loading or saving never do. A wheel a gamepad or the keyboard focus sends is not the mouse and fires nothing. - Pending fragment: `tools/native-hook-fragments/screen_mouse_scrolled.json`. ## In-game proof A test native mod cancelled the wheel over the open screen: the scroll hook fired, and a cancel path exists. No screenshot: the hook has no visuals of its own. ## Kind - [x] feature: something new for players (listed under New in the release notes) Label: feature ## Vanilla reference NeoForge `ScreenEvent.MouseScrolled.Pre`, fired from `MouseHandler.onScroll` before `Screen.mouseScrolled`. There is no parity harness for this ticket (it adds a hook, no vanilla behaviour changes). ## Other projects' code none ## Self-check Note: the pr_ready run below covers this PR and the next one stacked on it (the key hooks) together, against `screen-mouse-button`; the scope counts both. **pr_ready** (`tools/pr_ready.py --quick`) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +275 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 510 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ✅ 1580 passed | | doc tests | ✅ | | launcher | ➖ launcher untouched | | Parity | ➖ not run locally: CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | "Allow edits by maintainers" is on (default for fork PRs). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:19:49 +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#6389
No description provided.