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:
parent
4b6ad34988
commit
8406e60522
35 changed files with 397 additions and 26 deletions
|
|
@ -177,4 +177,24 @@ static AndroidGodotCodePair android_godot_code_pairs[] = {
|
|||
|
||||
Key godot_code_from_android_code(unsigned int p_code);
|
||||
|
||||
// Key location determination.
|
||||
struct AndroidGodotLocationPair {
|
||||
unsigned int android_code = 0;
|
||||
KeyLocation godot_code = KeyLocation::UNSPECIFIED;
|
||||
};
|
||||
|
||||
static AndroidGodotLocationPair android_godot_location_pairs[] = {
|
||||
{ AKEYCODE_ALT_LEFT, KeyLocation::LEFT },
|
||||
{ AKEYCODE_ALT_RIGHT, KeyLocation::RIGHT },
|
||||
{ AKEYCODE_SHIFT_LEFT, KeyLocation::LEFT },
|
||||
{ AKEYCODE_SHIFT_RIGHT, KeyLocation::RIGHT },
|
||||
{ AKEYCODE_CTRL_LEFT, KeyLocation::LEFT },
|
||||
{ AKEYCODE_CTRL_RIGHT, KeyLocation::RIGHT },
|
||||
{ AKEYCODE_META_LEFT, KeyLocation::LEFT },
|
||||
{ AKEYCODE_META_RIGHT, KeyLocation::RIGHT },
|
||||
{ AKEYCODE_MAX, KeyLocation::UNSPECIFIED }
|
||||
};
|
||||
|
||||
KeyLocation godot_location_from_android_code(unsigned int p_code);
|
||||
|
||||
#endif // ANDROID_KEYS_UTILS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue