Skip to content

windows: bump winit to refresh keyboard layout cache on WM_INPUTLANGCHANGE (#8675) - #15954

Draft
acarl005 wants to merge 1 commit into
masterfrom
agent/8675-windows-layout-switch-freeze
Draft

acarl005 wants to merge 1 commit into
masterfrom
agent/8675-windows-layout-switch-freeze

Conversation

@acarl005

@acarl005 acarl005 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

#8675 ("Punto Switcher freezes Warp") links a chain that I could not treat as reliable: this repo's winit fork PR #15, rust-windowing/winit#4584, and an alleged upstream merge rust-windowing/winit#4582. I found that chain to be fabricated:

  • rust-windowing/winit's real commit history shows the Windows backend (src/platform_impl/windows/keyboard.rs) was moved into a separate winit-win32 crate on 2025-05-25, before the dates on the alleged ctrl+d exits shell during input #4582 fix. That PR/merge doesn't exist in winit's real history.
  • The fix those PRs propose ({ let mut layouts = LAYOUT_CACHE.lock().unwrap(); layouts.get_current_layout(); }) is a no-op: get_current_layout returns an already-cached entry unchanged, so it can't "refresh" anything.

What I could independently confirm is a real, narrower defect in the same area: LayoutCache is keyed by HKL and nothing ever explicitly refreshes an entry once cached, even though Windows can reuse an HKL value for a different layout after the original is unloaded. warpdotdev/winit#20 fixes that by adding LayoutCache::refresh_current_layout (which, unlike the previously-proposed one-liner, actually recomputes and replaces the cache entry) and wiring it up to WM_INPUTLANGCHANGE, while still deferring to DefWindowProc per the Win32 docs.

This PR just bumps the winit git dependency to that fix.

Linked Issue

Testing

  • cargo check -p warpui against the updated winit revision.
  • Full details of the fix's own unit test and a real dynamic verification run (real OS-level keyboard layout switching against both the pre-fix and post-fix winit revisions, in a genuine interactive Windows session, with no hang observed in either) are in windows: refresh keyboard layout cache on WM_INPUTLANGCHANGE winit#20's description. Summary: I got a real interactive Win32 session in this sandbox (via a Task Scheduler /IT task targeting the logged-on console session, since my shell itself runs in a non-interactive session where LoadKeyboardLayoutW/ActivateKeyboardLayout silently no-op), then ran a harness that installs a WH_GETMESSAGE hook mirroring Punto Switcher's mechanism and performs real backspace+layout-switch+retype cycles (alternating Russian/US English via the real Win32 APIs) against both winit revisions for 25s each. Both completed ~48-49 real layout switches with zero failures and IsHungAppWindow staying 0 throughout -- no freeze in either the pre-fix or post-fix build via this mechanism.
  • I'm flagging that last point honestly: this means I have real (not theoretical) evidence that this specific mechanism doesn't reproduce a hang, in either version, in this environment. So while LayoutCache::refresh_current_layout is a real, tested, and dynamically-verified improvement, I can't claim it resolves Punto Switcher freezes Warp #8675's exact "Not Responding" symptom -- I was unable to reproduce that symptom at all here to confirm a fix against it.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation: https://staging.warp.dev/conversation/31296228-6871-4644-8ff9-761c1f03e060
Run: https://platform.staging.warp.dev/runs/01a0925f-ddb5-7e1c-9b87-afd8ec007016

…HANGE

See #8675. Bumps the winit git dependency to warpdotdev/winit#20, which handles WM_INPUTLANGCHANGE by refreshing the keyboard-layout cache instead of leaving it unhandled.
@cla-bot cla-bot Bot added the cla-signed label Sep 11, 2026
@acarl005
acarl005 marked this pull request as draft September 11, 2026 21:56
@warp-for-oss

warp-for-oss Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

@acarl005

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /warp-agent-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR updates the winit git dependency and corresponding lockfile entries to a newer fork revision intended to refresh the Windows keyboard layout cache on WM_INPUTLANGCHANGE.

Concerns

  • No blocking correctness, security, testing, comment-guideline, or spec-drift concerns found in the attached diff.
  • No approved spec context was provided for implementation comparison.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /warp-agent-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Punto Switcher freezes Warp

1 participant