Fix underscore input not working with jp106 keyboard on wayland platform #99633
+0
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where the underscore key can't be typed in the jp106 Japanese input environments on the wayland platform.
Details
Godot's wayland platform correctly converts keysyms using xkb and godot's xkb_keycode_map table.
However, in jp106 environments, when retrieving the physical key, physical_key becomes Key::NONE and input fails because the scancode_map table doesn't have a value set corresponding to underscore (0x61: backslash).
Solutions
Set Key::BACKSLASH to 0x61 in scancode_map
While this solution works correctly in jp106 keymap environments, it breaks the other environments where 0x61 is assigned to different keys.
Allow Key::NONE for physical_key
This seems valid as godot's windows implementation also allows Key::NONE for physical_key.
This PR implements solution 2.
Additional Notes
Godot currently stores scancodes as its internal code, but converting to internal codes can result in loss of information when using keymapping.
In the future, it might be better to store platform native scancodes.
Looking at Qt's implementation, scancode is stored as uint32 type with platform native values.
https://doc.qt.io/qt-6/qkeyevent.html