godotengine / godotengine/godot

If a modifier key like ^ ´ or ¨ is active (even if it hit before launching Godot) physical keycode output gets corrupted

Open
#96,451 0 comments 0 reactions 0 assignees View on GitHub
bug topic:input
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in 4.3

### System information

Windows 11 - Godot 4.3 stable

### Issue description

Keyboards in some regions have keys that when pressed do nothing until you press a second key.
As an example hitting "¨" and then "A" results in "Ä". ^ + A = Â etc.

"event.get_physical_keycode()" is applying said modifiers to all of it's output, if one is currently active.

Here's my test script:
```gdscript
extends Node

func _ready() -> void:
var actions: = InputMap.get_actions()
for action in actions:
var events: Array[InputEvent] = InputMap.action_get_events(action)
for event in events:
if (event is InputEventKey):
var keycode : Key = event.get_physical_keycode()
var physical_label: = DisplayServer.keyboard_get_label_from_physical(keycode)
var key_name: = OS.get_keycode_string(physical_label)
print(key_name)
```

It normally prints:
```
key_name: A
key_name: B
key_name: C
key_name: D
key_name: E
key_name: F
key_name: G
```

But if I hit ¨ key before launching the project:
```
key_name: Ä
key_name: ¨
key_name: ¨
key_name: ¨
key_name: Ë
key_name: ¨
key_name: ¨
```

To clarify: That's the entire script. No _input() is involved at all.

### Steps to reproduce

Have keyboard with a modifier key like ¨, ´ or ^.

1. Hit said key once.
2. Launch the project.

### Minimal reproduction project (MRP)

[umlaut-caret-bug-test.zip](https://github.com/user-attachments/files/16830764/umlaut-caret-bug-test.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached minimal reproduction project and reproduce the issue by pressing ¨, ´, or ^ before launch. Trace InputEventKey.get_physical_keycode() and DisplayServer.keyboard_get_label_from_physical() on Windows, then verify that physical labels remain unaffected by an active dead key and that the sample output returns the expected A–G values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.