[PR #1897] [MERGED] Menu buttons show the pointing hand under the mouse #3848

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1897
Author: @vlesmentie
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/pointing-hand-cursor


📝 Commits (1)

  • e4a151c Menu buttons show the pointing hand under the mouse

📊 Changes

4 files changed (+90 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+22 -0)
📝 crates/horizon-client/src/pack_screen.rs (+3 -0)
📝 crates/horizon-client/src/ui.rs (+1 -0)
📝 crates/horizon-client/src/widgets.rs (+64 -2)

📄 Description

🤖 Opened by vlesmentie's AI agent (Claude Code, Claude Opus 5.5), not by vlesmentie themselves.

What and why

Fixes #1347.

In 26.3 the mouse pointer turns into a pointing hand over a menu button (and into the not-allowed sign over a
disabled one). Horizon never changed the window's cursor, so it stayed an arrow.

  • widgets.rs: the frame's cursor request, as GuiGraphicsExtractor.requestCursor keeps it (the last request
    wins), widget_cursor(hovered, active) for AbstractWidget.handleCursor, and take_cursor, which hands the
    request over and starts the next frame from the arrow.
  • ui.rs: ui::button asks for it from its hover (the mouse). The resource pack screen's buttons
    (screen_draw::button) ask from the mouse hover at the call site, because their highlight also follows keyboard
    focus and the cursor must not.
  • game.rs: after render(), apply_cursor_icon sets winit's CursorIcon::Pointer, NotAllowed or Default
    on the window when the request changed, as GuiGraphicsExtractor.applyCursor → Window.selectCursor does.

Only buttons ask for now. 26.3 also asks from sliders (RESIZE_EW while dragging), scroll bars (RESIZE_NS), text
fields (IBEAM), command suggestions, clickable chat and a few container screens (loom, stonecutter, merchant,
creative tabs, advancements); widgets::Cursor has room for those as follow-ups.

Vanilla reference

  • AbstractWidget.handleCursor: hovered → requestCursor(isActive() ? CursorTypes.POINTING_HAND : CursorTypes.NOT_ALLOWED)
  • GuiGraphicsExtractor.requestCursor (sets pendingCursor) and applyCursor(Window) →
    Window.selectCursor(pendingCursor)
  • CursorTypes: ARROW, IBEAM, CROSSHAIR, POINTING_HAND, RESIZE_NS, RESIZE_EW, RESIZE_ALL,
    NOT_ALLOWED

Checked against the 26.3 client jar's bytecode (javap). Horizon-side the shapes come from winit's CursorIcon
(the issue's suggestion); there's no harness for the window cursor.

New test widgets::cursor_tests::hovered_widgets_ask_for_the_hand_or_not_allowed: no hover keeps the arrow,
an active hovered widget asks for the hand, an inactive one for not-allowed, the last request of a frame wins and
taking it resets the next frame.

Self-check

pr_ready (tools/pr_ready.py on debian, against origin/main at f5adaec20, 5 min 16 s)

Check Result
Scope ✅ 4 files, +90 −2
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (16 s)
clippy ✅ (1 min 26 s)
tests: horizon-client ✅ 1240 passed (3 min 29 s)
doc tests ✅ 0 passed (4 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): 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)

Not checked in game; the change only sets the window's cursor icon.

Screenshots

None: the pointer isn't in Horizon's own screenshots. The issue has vanilla's.

🤖 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/1897 **Author:** [@vlesmentie](https://github.com/vlesmentie) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/pointing-hand-cursor` --- ### 📝 Commits (1) - [`e4a151c`](https://github.com/horizon-rust/horizon/commit/e4a151c2e9dd78b09d5f76962df1ee6992061bf1) Menu buttons show the pointing hand under the mouse ### 📊 Changes **4 files changed** (+90 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+22 -0) 📝 `crates/horizon-client/src/pack_screen.rs` (+3 -0) 📝 `crates/horizon-client/src/ui.rs` (+1 -0) 📝 `crates/horizon-client/src/widgets.rs` (+64 -2) </details> ### 📄 Description > 🤖 Opened by vlesmentie's AI agent (Claude Code, Claude Opus 5.5), not by vlesmentie themselves. ## What and why Fixes #1347. In 26.3 the mouse pointer turns into a pointing hand over a menu button (and into the not-allowed sign over a disabled one). Horizon never changed the window's cursor, so it stayed an arrow. - `widgets.rs`: the frame's cursor request, as `GuiGraphicsExtractor.requestCursor` keeps it (the last request wins), `widget_cursor(hovered, active)` for `AbstractWidget.handleCursor`, and `take_cursor`, which hands the request over and starts the next frame from the arrow. - `ui.rs`: `ui::button` asks for it from its `hover` (the mouse). The resource pack screen's buttons (`screen_draw::button`) ask from the mouse hover at the call site, because their highlight also follows keyboard focus and the cursor must not. - `game.rs`: after `render()`, `apply_cursor_icon` sets winit's `CursorIcon::Pointer`, `NotAllowed` or `Default` on the window when the request changed, as `GuiGraphicsExtractor.applyCursor` → `Window.selectCursor` does. Only buttons ask for now. 26.3 also asks from sliders (`RESIZE_EW` while dragging), scroll bars (`RESIZE_NS`), text fields (`IBEAM`), command suggestions, clickable chat and a few container screens (loom, stonecutter, merchant, creative tabs, advancements); `widgets::Cursor` has room for those as follow-ups. ## Vanilla reference - `AbstractWidget.handleCursor`: hovered → `requestCursor(isActive() ? CursorTypes.POINTING_HAND : CursorTypes.NOT_ALLOWED)` - `GuiGraphicsExtractor.requestCursor` (sets `pendingCursor`) and `applyCursor(Window)` → `Window.selectCursor(pendingCursor)` - `CursorTypes`: `ARROW`, `IBEAM`, `CROSSHAIR`, `POINTING_HAND`, `RESIZE_NS`, `RESIZE_EW`, `RESIZE_ALL`, `NOT_ALLOWED` Checked against the 26.3 client jar's bytecode (`javap`). Horizon-side the shapes come from winit's `CursorIcon` (the issue's suggestion); there's no harness for the window cursor. New test `widgets::cursor_tests::hovered_widgets_ask_for_the_hand_or_not_allowed`: no hover keeps the arrow, an active hovered widget asks for the hand, an inactive one for not-allowed, the last request of a frame wins and taking it resets the next frame. ## Self-check **pr_ready** (`tools/pr_ready.py` on debian, against origin/main at f5adaec20, 5 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +90 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (16 s) | | clippy | ✅ (1 min 26 s) | | tests: horizon-client | ✅ 1240 passed (3 min 29 s) | | doc tests | ✅ 0 passed (4 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): 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) | Not checked in game; the change only sets the window's cursor icon. ## Screenshots None: the pointer isn't in Horizon's own screenshots. The issue has vanilla's. 🤖 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 04:12: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#3848
No description provided.