Fix Alt modifier stuck after Alt-Tab on Windows#52220
Merged
osiewicz merged 1 commit intozed-industries:mainfrom Apr 17, 2026
Merged
Fix Alt modifier stuck after Alt-Tab on Windows#52220osiewicz merged 1 commit intozed-industries:mainfrom
osiewicz merged 1 commit intozed-industries:mainfrom
Conversation
Contributor
osiewicz
approved these changes
Apr 16, 2026
Member
|
Thank you! |
auto-merge was automatically disabled
April 16, 2026 17:08
Head branch was pushed to by a user without write access
c70f4b6 to
a9d1588
Compare
Contributor
Author
|
Hi @osiewicz I noticed the CI failure was due to a git merge-base error after auto-merge. I've rebased the branch onto the latest main and force-pushed to ensure the common ancestor is clean. Would you mind taking another look? I think the CI should pass now or let me know if any further action is needed on my side? Thanks! |
AzureZee
added a commit
to AzureZee/gpuix
that referenced
this pull request
Apr 18, 2026
AzureZee
added a commit
to AzureZee/gpuix
that referenced
this pull request
Apr 18, 2026
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.
Context
Fixes a bug on Windows where the Alt modifier key becomes stuck in the pressed state after using Alt-Tab to switch away from and back to the Zed application.
Root Cause
In
crates/gpui_windows/src/events.rs, when the window loses focus during Alt-Tab, the WM_KEYUP event for the Alt key is never delivered to the application. The pending modifier state in GPUI remains asalt=true. When the window regains focus, there is no synchronization point to reset this stale state.How to Review
In
handle_activate_msg()(WM_ACTIVATE handler), when the window is activated:last_reported_modifiersandlast_reported_capslockset toNone)GetKeyState()APIsModifiersChangedevent with the true state to synchronize GPUISelf-Review Checklist
I think it's difficult to add tests for this because it's platform-dependent, but I recorded a video for comparison — sorry I only have an anime‑style app to show the key presses.
Video
previous.mp4
after.mp4
Closes #45485
Release Notes: