[PR #6148] [CLOSED] Windows: warp the pointer to the window before the mouse grab #6679

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6148
Author: @Domanffe
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: fix/windows-cursor-warp-before-grab


📝 Commits (1)

  • b3c0729 Windows: warp the pointer to the window before the mouse grab

📊 Changes

1 file changed (+6 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+6 -1)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Fixes #6076

Game::capture grabs with CursorGrabMode::Locked and warps the pointer to the
window's centre afterwards on every OS but macOS. On Windows that order cannot
work: winit 0.30.13 implements Locked as ClipCursor to a 1x1 rectangle at
the pointer's current position (src/platform_impl/windows/window_state.rs,
CursorFlags::refresh_os_cursor, the LOCKED branch), and SetCursorPos keeps
the pointer inside the current clip. The warp therefore cannot move it, which
is the 1x1 clip at (-1103,807) while the window sat at (104,104)-(1400,863) in
the report.

This warps before the grab on Windows too, the order macOS already uses for its
own reason. The focus condition the post-grab warp carried is not repeated:
capture returns early unless the window is focused, so this branch only runs
for the active window, the way MouseHandler.grabMouse does.

What I did not observe: the clip rectangle measured again on a running game.
Reproducing it freezes the pointer of whoever is at this machine, which is the
bug itself, so the evidence is winit's source and the report's measurements. No
other call site grabs the pointer (rg set_cursor_grab crates finds only
capture), so the changed order is the only path into the world.

The pr_ready block follows as a comment.


🔄 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/6148 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/windows-cursor-warp-before-grab` --- ### 📝 Commits (1) - [`b3c0729`](https://github.com/horizon-rust/horizon/commit/b3c07296848194f0c3e183efe8b12d142290c013) Windows: warp the pointer to the window before the mouse grab ### 📊 Changes **1 file changed** (+6 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+6 -1) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. Fixes #6076 `Game::capture` grabs with `CursorGrabMode::Locked` and warps the pointer to the window's centre afterwards on every OS but macOS. On Windows that order cannot work: winit 0.30.13 implements `Locked` as `ClipCursor` to a 1x1 rectangle at the pointer's current position (`src/platform_impl/windows/window_state.rs`, `CursorFlags::refresh_os_cursor`, the `LOCKED` branch), and `SetCursorPos` keeps the pointer inside the current clip. The warp therefore cannot move it, which is the 1x1 clip at (-1103,807) while the window sat at (104,104)-(1400,863) in the report. This warps before the grab on Windows too, the order macOS already uses for its own reason. The focus condition the post-grab warp carried is not repeated: `capture` returns early unless the window is focused, so this branch only runs for the active window, the way `MouseHandler.grabMouse` does. What I did not observe: the clip rectangle measured again on a running game. Reproducing it freezes the pointer of whoever is at this machine, which is the bug itself, so the evidence is winit's source and the report's measurements. No other call site grabs the pointer (`rg set_cursor_grab crates` finds only `capture`), so the changed order is the only path into the world. The `pr_ready` block follows as a comment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:24:50 +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#6679
No description provided.