fix(windows): release cursor clip on focus loss (v0.30.x backport) - #4655
Open
Saratii wants to merge 4 commits into
Open
fix(windows): release cursor clip on focus loss (v0.30.x backport)#4655Saratii wants to merge 4 commits into
Saratii wants to merge 4 commits into
Conversation
ClipCursor is global OS state that Windows does not reset when a window loses focus. A clip rect applied while the window was focused therefore stayed active after focus loss, keeping the cursor trapped in the unfocused window. Worse, set_cursor_grab(CursorGrabMode::None) could not release it either, because refresh_os_cursor skips all ClipCursor updates when the window is not focused. Fix by releasing the active clip in refresh_os_cursor when the window is unfocused and the clip lies within the window client area (i.e. it is the clip this window applied, not one belonging to the now-active application), and by refreshing cursor flags on WM_KILLFOCUS/WM_SETFOCUS so the clip is released on focus loss and reapplied on focus gain even if the application does not change the grab mode itself. Fixes the Windows half of bevyengine/bevy#22750. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Saratii
force-pushed
the
fix/win32-release-cursor-clip-on-focus-loss-v0.30
branch
from
August 1, 2026 23:11
abca7f8 to
37be33c
Compare
The pinned-dependency approach for testing MSRV 1.70 has rotted beyond repair: a fresh lockfile now resolves crates that use edition 2024 (which cargo 1.70 cannot even parse), the syn pin became ambiguous with both syn 2 and syn 3 in the graph, and the wasm-bindgen family uses exact cross-version pins that cannot be downgraded one crate at a time. The branch's own wayland dependencies have required rustc 1.71+ on any fresh resolution for some time, so the declared 1.70 MSRV was already unbuildable for new users. Run the MSRV job on 1.86 (the same MSRV master tests against) with a plain generated lockfile, matching master's pin-free CI. Verified locally that winit v0.30.x checks and docs cleanly on 1.86 with a fresh unpinned lockfile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rust 1.97 clippy added manual_filter/iter_kv_map suggestions that fire in the Linux backends under -D clippy::all, and nightly rustdoc's invalid_html_tags lint now trips over doc comments where a bare * inside kbd tags is parsed as markdown emphasis spanning the HTML tags. Apply the clippy suggestions and escape the asterisks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
CI on this branch had rotted independently of the backport (every job failed the same way before any change here), so this PR now carries three extra commits to revive it:
The first commit remains the actual backported fix, unchanged. |
Saratii
force-pushed
the
fix/win32-release-cursor-clip-on-focus-loss-v0.30
branch
2 times, most recently
from
August 1, 2026 23:24
62fdace to
02aa2b1
Compare
- Ignore RUSTSEC-2026-0192 (ttf-parser unmaintained): pulled in via sctk-adwaita, no safe upgrade available. - Skip syn@2 in the duplicate check: proc-macro crates are migrating to syn 3, so both major versions appear in the graph. - Bypass libc's etc/libc-util.py, an interpreted script shipped in recent libc releases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #4654 to
v0.30.x.ClipCursoris global OS state that Windows does not reset when a window loses focus, so a clip applied while focused stayed active after focus loss, trapping the cursor in the unfocused window — andset_cursor_grab(CursorGrabMode::None)could not release it, becauserefresh_os_cursorskips allClipCursorupdates while unfocused. See #4654 for details.Fixes the Windows half of bevyengine/bevy#22750, which is on winit 0.30.
🤖 Generated with Claude Code