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

Documentation on physical_keycode is incorrect #82091

Closed
jitspoe opened this issue Sep 22, 2023 · 1 comment · Fixed by #82092
Closed

Documentation on physical_keycode is incorrect #82091

jitspoe opened this issue Sep 22, 2023 · 1 comment · Fixed by #82092

Comments

@jitspoe
Copy link
Contributor

jitspoe commented Sep 22, 2023

Godot version

4.1.1.stable.official

System information

Windows 10, Vulkan forward +

Issue description

Current documentation:

● Key physical_keycode [default: 0]set_physical_keycode(value) setterget_physical_keycode() getter

Represents the physical location of a key on the 101/102-key US QWERTY keyboard, which corresponds to one of the Key constants.

To get a human-readable representation of the InputEventKey, use OS.get_keycode_string(event.keycode) where event is the InputEventKey.

A) The example doesn't use physical_keycode.
B) This will return the QWERTY keys, not the actual key letter the user should see if they're using a non-QWERTY layout.

The way to get the correct representation is OS.get_keycode_string(DisplayServer.keyboard_get_keycode_from_physical(event.physical_keycode))

I'm just opening an issue to correspond with a PR I'm writing.

Steps to reproduce

Look at the InputEventKey documentation.

Minimal reproduction project

N/A.

@jitspoe
Copy link
Contributor Author

jitspoe commented Sep 22, 2023

It might also be worth noting in the documentation that key_label and keycode are not set for key bindings that use the physical key (which is the default for adding actions).

@dalexeev dalexeev added this to the 4.2 milestone Sep 22, 2023
rsburke4 pushed a commit to rsburke4/godot that referenced this issue Nov 10, 2023
GuybrushThreepwood-GitHub pushed a commit to GuybrushThreepwood-GitHub/godot that referenced this issue Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants