1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add InputEventKey.location to tell left from right

This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
This commit is contained in:
Mel Collins
2023-08-03 15:18:26 +02:00
parent 4b6ad34988
commit 8406e60522
35 changed files with 397 additions and 26 deletions

View File

@@ -38,3 +38,12 @@ Key godot_code_from_android_code(unsigned int p_code) {
}
return Key::UNKNOWN;
}
KeyLocation godot_location_from_android_code(unsigned int p_code) {
for (int i = 0; android_godot_location_pairs[i].android_code != AKEYCODE_MAX; i++) {
if (android_godot_location_pairs[i].android_code == p_code) {
return android_godot_location_pairs[i].godot_code;
}
}
return KeyLocation::UNSPECIFIED;
}