From 90b8a2ae8c7af4a031c23112c73e3b595feb118d Mon Sep 17 00:00:00 2001 From: AttackButton Date: Sun, 27 Aug 2023 16:10:13 -0300 Subject: [PATCH] Add missing YEN, SECTION and OPENURL names to keycode mappings (cherry picked from commit 8908ac4e6e53daa4b0a43269757b082704740251) --- core/core_constants.cpp | 8 ++++---- core/os/keyboard.cpp | 3 +++ core/os/keyboard.h | 2 ++ doc/classes/@GlobalScope.xml | 24 ++++++++++++------------ 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 2332bc235bd..33b32714957 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -420,6 +420,10 @@ void register_global_constants() { BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHD); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHE); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHF); + BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GLOBE); + BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KEYBOARD); + BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_EISU); + BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_KANA); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UNKNOWN); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPACE); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EXCLAM); @@ -492,10 +496,6 @@ void register_global_constants() { BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIITILDE); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YEN); BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SECTION); - BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GLOBE); - BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KEYBOARD); - BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_EISU); - BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_KANA); BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_CODE_MASK, CODE_MASK); BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_MODIFIER_MASK, MODIFIER_MASK); diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp index 1a51624030e..60788828390 100644 --- a/core/os/keyboard.cpp +++ b/core/os/keyboard.cpp @@ -146,6 +146,7 @@ static const _KeyCodeText _keycodes[] = { {Key::FAVORITES ,"Favorites"}, {Key::SEARCH ,"Search"}, {Key::STANDBY ,"StandBy"}, + {Key::OPENURL ,"OpenURL"}, {Key::LAUNCHMAIL ,"LaunchMail"}, {Key::LAUNCHMEDIA ,"LaunchMedia"}, {Key::LAUNCH0 ,"Launch0"}, @@ -238,6 +239,8 @@ static const _KeyCodeText _keycodes[] = { {Key::BAR ,"Bar"}, {Key::BRACERIGHT ,"BraceRight"}, {Key::ASCIITILDE ,"AsciiTilde"}, + {Key::YEN ,"Yen"}, + {Key::SECTION ,"Section"}, {Key::NONE ,nullptr} /* clang-format on */ }; diff --git a/core/os/keyboard.h b/core/os/keyboard.h index cf276dc49f2..785972d31d9 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -33,6 +33,8 @@ #include "core/string/ustring.h" +// Keep the values in this enum in sync with `_keycodes` in `keyboard.cpp`, +// and the bindings in `core_constants.cpp`. enum class Key { NONE = 0, // Special key: The strategy here is similar to the one used by toolkits, diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index f8bb4dec889..c375cd0e7ad 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2032,6 +2032,18 @@ Launch Shortcut F key. + + "Globe" key on Mac / iPad keyboard. + + + "On-screen keyboard" key on iPad keyboard. + + + 英数 key on Mac keyboard. + + + かな key on Mac keyboard. + Unknown key. @@ -2248,18 +2260,6 @@ § key. - - "Globe" key on Mac / iPad keyboard. - - - "On-screen keyboard" key iPad keyboard. - - - 英数 key on Mac keyboard. - - - かな key on Mac keyboard. - Key Code mask.