Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix behavior of find_keycode_from_string() being platform-specific

kobewiab6467c7a4f3
diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp
index 87bb29673b5..a4584f4a424 100644
--- a/core/os/keyboard.cpp
+++ b/core/os/keyboard.cpp
@@ -62,18 +62,29 @@ static const _KeyCodeText _keycodes[] = {
{Key::PAGEDOWN ,"PageDown"},
{Key::SHIFT ,"Shift"},
{Key::CTRL ,"Ctrl"},
+ // Include all strings for all platforms. The first string
+ // should be the one expected from get_keycode_string().
#if defined(MACOS_ENABLED)
{Key::META ,"Command"},
+ {Key::META ,"Windows"},
+ {Key::META ,"Meta"},
{Key::CMD_OR_CTRL ,"Command"},
{Key::ALT ,"Option"},
+ {Key::ALT ,"Alt"},
#elif defined(WINDOWS_ENABLED)
{Key::META ,"Windows"},
+ {Key::META ,"Command"},
+ {Key::META ,"Meta"},
{Key::CMD_OR_CTRL ,"Ctrl"},
{Key::ALT ,"Alt"},
+ {Key::ALT ,"Option"},
#else
{Key::META ,"Meta"},
+ {Key::META ,"Windows"},
+ {Key::META ,"Command"},
{Key::CMD_OR_CTRL ,"Ctrl"},
{Key::ALT ,"Alt"},
+ {Key::ALT ,"Option"},
#endif
{Key::CAPSLOCK ,"CapsLock"},
{Key::NUMLOCK ,"NumLock"},