Skip to content
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

GetKeyboardLayout is not updated during a console session #83

Open
bitcrazed opened this issue Feb 16, 2018 · 4 comments

Comments

@bitcrazed
Copy link
Contributor

commented Feb 16, 2018

From @matial on August 13, 2017 21:0

  • Your Windows build number: version 10.0.14393

  • Calling GetKeyboardLayout(0) periodically within a console application returns the handle of the keyboard layout active when starting the console. If the keyboard layout is changed while the console app is running, subsequent calls to GetKeyboardLayout do not reflect the new active layout.

  • What's wrong / what should be happening instead: GetKeyboardLayout should return the handle of the last activated keyboard layout.

Copied from original issue: microsoft/WSL#2418

@bitcrazed bitcrazed added the console label Feb 16, 2018

@bitcrazed

This comment has been minimized.

Copy link
Contributor Author

commented Feb 16, 2018

From @sunilmut on August 16, 2017 16:41

@matial - Thanks for your post. Is this a WSL/bash on Windows specific issue? Looks like a concern with the generic console API.

@bitcrazed

This comment has been minimized.

Copy link
Contributor Author

commented Feb 16, 2018

From @matial on August 16, 2017 18:44

@sunilmut - Yes it is a generic console API problem.

@miniksa

This comment has been minimized.

Copy link
Member

commented May 29, 2019

GetKeyboardLayout is a user32 thing... not specifically a console thing. We might need to hand this off to a different team via an internal issue.

@alabuzhev

This comment has been minimized.

Copy link

commented Aug 21, 2019

not specifically a console thing

There's an undocumented functiton GetConsoleKeyboardLayoutNameW in kernel32.dll, available at least since Windows 2000.
Despite being undocumented, it worked as expected until Windows 10.
And it still works as expected in legacy console mode.
In default mode, however, it now returns false and sets the last error to 16385 :(

If it's too hard to implement GetKeyboardLayout properly, can at least GetConsoleKeyboardLayoutNameW be fixed please? (undocumented == no guarantees, I know, but still).
Or maybe knowing how it works can help fixing GetKeyboardLayout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.