Skip to content

Fix TextServicesManager scan code forwarding for TSF#11644

Open
calisto-le wants to merge 2 commits into
dotnet:mainfrom
calisto-le:fix/11635-tsf-scancode
Open

Fix TextServicesManager scan code forwarding for TSF#11644
calisto-le wants to merge 2 commits into
dotnet:mainfrom
calisto-le:fix/11635-tsf-scancode

Conversation

@calisto-le
Copy link
Copy Markdown

@calisto-le calisto-le commented May 15, 2026

Fixes #11635

Description

TextServicesManager currently passes 0 as the scan code for almost all keys when forwarding keystrokes to TSF.

This change forwards keyArgs.ScanCode instead, so the scan-code bits in the lParam passed to TextServicesContext.Keystroke are populated correctly.

Existing LeftShift/RightShift special handling remains unchanged.

Customer Impact

Text services, IMEs, or TIPs that rely on scan-code information will receive the correct scan code instead of just 0.

Regression

No. The issue reports this as not being a regression.

Testing

.\build.cmd -pack -plat x64 -test

Tested with a sample TextBox application using locally built WPF assemblies.

Manually verified generated lParam values passed to TextServicesContext.Keystroke, including:

  • RightCtrl: scan=0x1D, extended=true
  • RightAlt / AltGr: scan=0x38, extended=true
  • Normal Enter: scan=0x1C, extended=false
  • Numpad Enter: scan=0x1C, extended=true
  • Dedicated Delete: scan=0x53, extended=true
  • Numpad: scan=0x35, extended=true
  • LeftShift: scan=0x2A, extended=false, wParam=VK_SHIFT
  • RightShift: scan=0x36, extended=false, wParam=VK_SHIFT

Risk

Low.
The change only forwards the existing scan code value.
If there is any more testing to do please let me know.

Microsoft Reviewers: Open in CodeFlow

@calisto-le calisto-le requested a review from a team May 15, 2026 15:38
@miloush
Copy link
Copy Markdown
Contributor

miloush commented May 16, 2026

I suggest the extended key flag is also set as a part of this fix.

@calisto-le
Copy link
Copy Markdown
Author

Added the extended-key flag handling and verified the generated lParam values manually against the Win32 keyboard message layout.
Verified cases see above in Testing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scancode not passed to TSF

2 participants