-
Notifications
You must be signed in to change notification settings - Fork 902
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
Virtual Keycode is incorrect on macOS non-qwerty layouts #752
Comments
Thanks for reporting this! We're currently using This is wrong, since that's really just a scancode: https://stackoverflow.com/a/18413469/5435443 We likely inherited this oversight from GLFW, since it's done the same way there (and in SDL). It doesn't look like AppKit has a concept of layout-aware virtual key codes. WebKit has a good explanation and solution here: If you're interested in contributing, this would likely be an easy PR. Otherwise, it would be a week or so before I'd get a chance to implement this myself. |
I will definitely have a look, thank you! |
@chrisduerr are you aware of any Alacritty bugs that look like they're caused by this? (or any people who might want to test #755?) |
The issue that comes to mind is alacritty/alacritty#458. I've linked the PR there for anyone interested in testing. |
* Fix incorrect keycodes when using a non-US keyboard layout. This commit fixes the issue described in #752, and uses the advised method to fix it. * Style fixes Co-Authored-By: Toqozz <[email protected]> * Refactoring of macOS `virtualkeycode` fix (#752) * Applies requested changes as per pull request discussion (#755).
…dowing#755) * Fix incorrect keycodes when using a non-US keyboard layout. This commit fixes the issue described in rust-windowing#752, and uses the advised method to fix it. * Style fixes Co-Authored-By: Toqozz <[email protected]> * Refactoring of macOS `virtualkeycode` fix (rust-windowing#752) * Applies requested changes as per pull request discussion (rust-windowing#755).
…dowing#755) * Fix incorrect keycodes when using a non-US keyboard layout. This commit fixes the issue described in rust-windowing#752, and uses the advised method to fix it. * Style fixes Co-Authored-By: Toqozz <[email protected]> * Refactoring of macOS `virtualkeycode` fix (rust-windowing#752) * Applies requested changes as per pull request discussion (rust-windowing#755).
…dowing#755) * Fix incorrect keycodes when using a non-US keyboard layout. This commit fixes the issue described in rust-windowing#752, and uses the advised method to fix it. * Style fixes Co-Authored-By: Toqozz <[email protected]> * Refactoring of macOS `virtualkeycode` fix (rust-windowing#752) * Applies requested changes as per pull request discussion (rust-windowing#755).
…dowing#755) * Fix incorrect keycodes when using a non-US keyboard layout. This commit fixes the issue described in rust-windowing#752, and uses the advised method to fix it. * Style fixes Co-Authored-By: Toqozz <[email protected]> * Refactoring of macOS `virtualkeycode` fix (rust-windowing#752) * Applies requested changes as per pull request discussion (rust-windowing#755).
The
virtual_keycode
field seems to be incorrect when using a non-qwerty layout. It seems to always return values corresponding to the qwerty (or perhaps physical?) layout.I'm running the following program:
Pressing a dvorak
P
here (qwerty 'R') results in the following lines:As you can see, we receive
virtual_keycode: Some(R)
. Also note that right after the window receives theP
character. (Shouldn't these always be the same?)The issue doesn't seem to occur on Linux/X11.
The text was updated successfully, but these errors were encountered: