PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Keyboard Manager bug

Open ujex256 opened this issue 1 year ago • 2 comments

Microsoft PowerToys version

"0.61.1"

Running as admin

  • [X] Yes

Area(s) with issue?

Keyboard Manager

Steps to reproduce

PowerToysReport_2022-08-05-22-41-36.zip After remapping VK 240 to the Ctrl key in Keyboard Manager, pressing VK 240 (Caps Lock) always presses the Ctrl key. (This is using a translation, so there may be some unnatural parts).

✔️ Expected Behavior

Replaced by Ctrl key

❌ Actual Behavior

Ctrl key is always pressed.

Other Software

No response

ujex256 avatar Aug 05 '22 13:08 ujex256

Not the expert here, but I was looking at https://docs.microsoft.com/windows/win32/inputdev/virtual-key-codes and there 0x14 (or 20 in decimal) equals CAPS LOCK key... Where and why did you get "VK 240"?

Jay-o-Way avatar Aug 05 '22 14:08 Jay-o-Way

Not the expert here, but I was looking at https://docs.microsoft.com/windows/win32/inputdev/virtual-key-codes and there 0x14 (or 20 in decimal) equals CAPS LOCK key... Where and why did you get "VK 240"?

I am Japanese and use a Japanese keyboard. I don't know if this has anything to do with it, but when I press the CapsLock key, it is recognized as VK 240.

ujex256 avatar Aug 05 '22 23:08 ujex256

これとほぼ一緒。

same.

https://github.com/microsoft/PowerToys/issues/3397

結論から言うと、osの論理キーボードがjis環境下では、"a"キー左隣の英数/capslockキーをctrlにremapする方法は、現在のpowertoysで期待通りに動作させることは不可能です。

バグではなく日本語imeの挙動が問題なのです。powertoysは正常に動作しています。

解決方法はレジストリを書き換えることが1番簡単です。

os側の論理キーボードがjisの場合のみ発生します。(主にkbd106.dll)

この問題は定期的に報告されているけど、既知かつ誰も修正できていない。2年以上前から。私もかつて修正にトライしたけど、日本語imeモジュールの複雑怪奇な挙動のせいで諦めました。

物理キーボードではなく、os側で指定している論理キーボードドライバーがkbd106.dllが日本語windowsのデフォルトだと思う。確認方法は"p"キーの一つ右横のキーを押して"@"が出力される。

この場合、刻印にはcapslockと書いてあるが、このキーはcapslockのvkを発生させない。英数キーだ。英数キーとは日本語jisドライバに存在するvkで、キーボードのスキャンコードは同じだが、os側での解釈が違いvk240と理解する。

もしjisキーボードでcapslockと同一のvkを発生させたい場合は、shift + 英数キー、でcapslockのvkを発生させれる。

BlastBeated avatar Aug 11 '22 02:08 BlastBeated

なるほど、よくわかりました。色々複雑で修正は難しいのですね。ありがとうございました。

ujex256 avatar Aug 15 '22 05:08 ujex256