-
Notifications
You must be signed in to change notification settings - Fork 8.1k
[Keyboard Manager] Fix stuck modifiers and dropped key-to-text remaps #48571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
crutkas
wants to merge
7
commits into
microsoft:main
Choose a base branch
from
crutkas:user/crutkas/fix-kbm-text-remap-stuck-keys
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0dfb380
fix(kbm): Handle SendVirtualInput failures and release modifiers for …
crutkas 60276c1
fix: Fix 'pressedthen' typo in comment
crutkas b474270
fix(kbm): Add Win key to modifier release, check SendVirtualInput ret…
crutkas 6a7a29e
Don't re-press released modifiers after text remap to avoid stuck keys
crutkas cc8e837
Harden key-to-text remap: dummy key, WM_SYSKEYDOWN, mockable text inj…
crutkas 6682133
[KeyboardManager] Fix stuck key on asymmetric remap injection failure
crutkas dcf4aa7
[KeyboardManager] Fix check-spelling forbidden pattern in State.h com…
crutkas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,19 @@ | ||
| #pragma once | ||
| #include <keyboardmanager/common/MappingConfiguration.h> | ||
| #include <unordered_set> | ||
|
|
||
| class State : public MappingConfiguration | ||
| { | ||
| private: | ||
| // Stores the activated target application in app-specific shortcut | ||
| std::wstring activatedAppSpecificShortcutTarget; | ||
|
|
||
| // Source keys whose single-key remap key-down injection was blocked, so the original | ||
| // key-down was passed through to the foreground app. The matching key-up must be | ||
| // passed through too, otherwise the physical key is stranded DOWN. Only accessed from | ||
Check failureCode scanning / check-spelling Forbidden Pattern Error
, otherwise matches a line_forbidden.patterns rule: Should be '; otherwise' or '. Otherwise' - ', [Oo]therwise\\b'
|
||
| // the (serialized) low-level keyboard hook thread. | ||
| std::unordered_set<DWORD> singleKeyRemapInjectionFailedKeys; | ||
|
|
||
| public: | ||
| // Function to get the iterator of a single key remap given the source key. Returns nullopt if it isn't remapped | ||
| std::optional<SingleKeyRemapTable::iterator> GetSingleKeyRemap(const DWORD& originalKey); | ||
|
|
@@ -26,4 +33,14 @@ | |
|
|
||
| // Gets the activated target application in app-specific shortcut | ||
| std::wstring GetActivatedApp(); | ||
|
|
||
| // Records (failed == true) or clears (failed == false) that the single-key remap | ||
| // key-down injection for sourceKey was blocked and the original key-down was passed | ||
| // through to the foreground app. | ||
| void SetSingleKeyRemapInjectionFailed(const DWORD sourceKey, const bool failed); | ||
|
|
||
| // Returns true and clears the marker if sourceKey's single-key remap key-down | ||
| // injection was previously blocked, indicating that its key-up should be passed | ||
| // through as well. | ||
| bool ConsumeSingleKeyRemapInjectionFailed(const DWORD sourceKey); | ||
| }; | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.