-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
[3.x] Fix non-latin layout scancodes on Linux, adds access to physical scancodes. #46764
[3.x] Fix non-latin layout scancodes on Linux, adds access to physical scancodes. #46764
Conversation
43fd802
to
266e731
Compare
@@ -253,6 +253,7 @@ static Ref<InputEventKey> setup_key_event(const EmscriptenKeyboardEvent *emscrip | |||
ev->set_echo(emscripten_event->repeat); | |||
dom2godot_mod(emscripten_event, ev); | |||
ev->set_scancode(dom_code2godot_scancode(emscripten_event->code, emscripten_event->key)); | |||
ev->set_physical_scancode(dom_code2godot_scancode(emscripten_event->code, emscripten_event->key)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is actually "proper" (quoted because we are still talking about the web :( ) implementation for this. Let me do the backport on top of these changes so you could simply add it on top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Faless@516eace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I have pulled JS commit to the PR branch.
…utEventKey and InputMap. Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
This uses the `event.code` value to retrieve the physical code, while still using the extra logic to map the unicode value to our keylist, when computing the `scancode` (supporting ASCII and Latin-1).
516eace
to
8740e95
Compare
Thanks! |
Does this mean we'll be able to bind the default keys based on key positions instead of the letters of the keys? Would be great for non-qwerty keyboard users! |
Yes 🙂 I haven't checked the |
Awesome! I saw there's a physical_key that gets written to the project file, but it seems to always be 0. Maybe it's only supported in Linux at the moment? |
@jitspoe Should work on all platforms, but |
Is there a way to get the display string from a physical_key? Can't seem to find anything, so I made a proposal here: godotengine/godot-proposals#3571 |
I really appreciate this!! Was really hoping I wouldn't have to wait until 4.0 for this and thankfully that is now the case. |
Backport of #18020, without breaking changes.
Existing Functions properties are not renamed, new property is
physical_scancode
.For the reference, list of changes to existing API (in both cases physical scancode is used only if remapped scancode is
0
):InputEventKey::action_match
uses physical scancode, if remapped scancode is0
(Physical key are added toInputMap
withscancodes == 0
, remapped keys withphysical_scancode == 0
).0
(not remapped correctly byXLookupString
).Modified test project from 46751: Test.zip
Screenshots:
Dvorak:Fixes #46751 and fixes #46750