Skip to content

Replay both key down and up for Win in GrabAndMove#47326

Merged
LegendaryBlair merged 1 commit intomicrosoft:mainfrom
foxmsft:foxmsft/replay-winkey
Apr 29, 2026
Merged

Replay both key down and up for Win in GrabAndMove#47326
LegendaryBlair merged 1 commit intomicrosoft:mainfrom
foxmsft:foxmsft/replay-winkey

Conversation

@foxmsft
Copy link
Copy Markdown
Contributor

@foxmsft foxmsft commented Apr 28, 2026

Summary of the Pull Request

The code for keyup on the Win key would replay the previously absorbed keydown event and just leave this keyup to propagate normally, thus leading to a race condition between CallNextHookEx and SendInput. This resulted in almost guaranteed out-of-order event (Win up, followed by Win down) in the case of Win+G (the Xbox Game bar shortcut).

Fixed by also absorbing the keyup for Win, but calling SendInput for both keydown and keyup.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@github-actions
Copy link
Copy Markdown

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (1)

DEFAULTTONEAREST

These words are not needed and should be removed defaulttonearest

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:foxmsft/PowerToys.git repository
on the foxmsft/replay-winkey branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/25083302088/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

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.

Keyboard input bug in new "Grab and Move" feature

2 participants