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

Fix key mapping changes when moving from macOS to other platform

Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
This commit is contained in:
bruvzg
2022-09-02 12:37:48 +03:00
parent 6b92dbfce2
commit 6f4d233062
50 changed files with 513 additions and 494 deletions

View File

@@ -61,12 +61,16 @@ static const _KeyCodeText _keycodes[] = {
{Key::PAGEDOWN ,"PageDown"},
{Key::SHIFT ,"Shift"},
{Key::CTRL ,"Ctrl"},
#ifdef MACOS_ENABLED
#if defined(MACOS_ENABLED)
{Key::META ,"Command"},
{Key::ALT ,"Option"},
#elif defined(WINDOWS_ENABLED)
{Key::META ,"Windows"},
{Key::ALT ,"Alt"},
#else
{Key::META ,"Meta"},
#endif
{Key::ALT ,"Alt"},
#endif
{Key::CAPSLOCK ,"CapsLock"},
{Key::NUMLOCK ,"NumLock"},
{Key::SCROLLLOCK ,"ScrollLock"},
@@ -437,6 +441,14 @@ String keycode_get_string(Key p_code) {
codestr += find_keycode_name(Key::ALT);
codestr += "+";
}
if ((p_code & KeyModifierMask::CMD_OR_CTRL) != Key::NONE) {
#ifdef MACOS_ENABLED
codestr += find_keycode_name(Key::META);
#else
codestr += find_keycode_name(Key::CTRL);
#endif
codestr += "+";
}
if ((p_code & KeyModifierMask::CTRL) != Key::NONE) {
codestr += find_keycode_name(Key::CTRL);
codestr += "+";