Conversation
…turns an unsigned int we must be more explisit about filtering out dead keys. A dead key is denoted when the highest bit is set.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an error that was introduced when ctypes definitions were tightened for user32.MapVirtualKeyEx. Previously, typing dead keys (like acute on German keyboard) would throw a ValueError when trying to convert the result to a character.
- Added explicit filtering to detect and exclude dead keys before character conversion
- Dead keys are identified by checking if the highest bit (bit 31) is set in the 32-bit return value
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
LeonarddeR
approved these changes
Sep 16, 2025
Collaborator
LeonarddeR
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
seanbudd
approved these changes
Sep 16, 2025
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.
Link to issue number:
Fixes #18908
Summary of the issue:
After we moved to a tightened ctypes definition for user32.MapVirtualKeyEx, typing dead keys such as an acute on a German keyboard layout would throw an error such as:
Description of user facing changes:
No longer throws an error when typing dead keys.
Description of developer facing changes:
Description of development approach:
KeyboardInputGesture.mainKeyName: As MapVirtualKeyEx now correctly returns an unsigned int we must be more explisit about filtering out dead keys. A dead key is denoted when the highest bit is set.
Testing strategy:
Known issues with pull request:
None known.
Code Review Checklist: