summaryrefslogtreecommitdiff
path: root/core/os/keyboard.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/os/keyboard.h')
-rw-r--r--core/os/keyboard.h152
1 files changed, 45 insertions, 107 deletions
diff --git a/core/os/keyboard.h b/core/os/keyboard.h
index e5d9b24e85..84017e89a6 100644
--- a/core/os/keyboard.h
+++ b/core/os/keyboard.h
@@ -1,32 +1,32 @@
-/*************************************************************************/
-/* keyboard.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
+/**************************************************************************/
+/* keyboard.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
#ifndef KEYBOARD_H
#define KEYBOARD_H
@@ -65,6 +65,11 @@ enum class Key {
SHIFT = SPECIAL | 0x15,
CTRL = SPECIAL | 0x16,
META = SPECIAL | 0x17,
+#if defined(MACOS_ENABLED)
+ CMD_OR_CTRL = META,
+#else
+ CMD_OR_CTRL = CTRL,
+#endif
ALT = SPECIAL | 0x18,
CAPSLOCK = SPECIAL | 0x19,
NUMLOCK = SPECIAL | 0x1A,
@@ -119,14 +124,9 @@ enum class Key {
KP_7 = SPECIAL | 0x8D,
KP_8 = SPECIAL | 0x8E,
KP_9 = SPECIAL | 0x8F,
- SUPER_L = SPECIAL | 0x40,
- SUPER_R = SPECIAL | 0x41,
MENU = SPECIAL | 0x42,
- HYPER_L = SPECIAL | 0x43,
- HYPER_R = SPECIAL | 0x44,
+ HYPER = SPECIAL | 0x43,
HELP = SPECIAL | 0x45,
- DIRECTION_L = SPECIAL | 0x46,
- DIRECTION_R = SPECIAL | 0x47,
BACK = SPECIAL | 0x48,
FORWARD = SPECIAL | 0x49,
STOP = SPECIAL | 0x4A,
@@ -134,11 +134,6 @@ enum class Key {
VOLUMEDOWN = SPECIAL | 0x4C,
VOLUMEMUTE = SPECIAL | 0x4D,
VOLUMEUP = SPECIAL | 0x4E,
- BASSBOOST = SPECIAL | 0x4F,
- BASSUP = SPECIAL | 0x50,
- BASSDOWN = SPECIAL | 0x51,
- TREBLEUP = SPECIAL | 0x52,
- TREBLEDOWN = SPECIAL | 0x53,
MEDIAPLAY = SPECIAL | 0x54,
MEDIASTOP = SPECIAL | 0x55,
MEDIAPREVIOUS = SPECIAL | 0x56,
@@ -168,7 +163,12 @@ enum class Key {
LAUNCHE = SPECIAL | 0x6E,
LAUNCHF = SPECIAL | 0x6F,
- UNKNOWN = SPECIAL | 0xFFFFFF,
+ GLOBE = SPECIAL | 0x70,
+ KEYBOARD = SPECIAL | 0x71,
+ JIS_EISU = SPECIAL | 0x72,
+ JIS_KANA = SPECIAL | 0x73,
+
+ UNKNOWN = SPECIAL | 0x7FFFFF,
/* PRINTABLE LATIN 1 CODES */
@@ -241,74 +241,8 @@ enum class Key {
BAR = 0x007C,
BRACERIGHT = 0x007D,
ASCIITILDE = 0x007E,
- NOBREAKSPACE = 0x00A0,
- EXCLAMDOWN = 0x00A1,
- CENT = 0x00A2,
- STERLING = 0x00A3,
- CURRENCY = 0x00A4,
YEN = 0x00A5,
- BROKENBAR = 0x00A6,
SECTION = 0x00A7,
- DIAERESIS = 0x00A8,
- COPYRIGHT = 0x00A9,
- ORDFEMININE = 0x00AA,
- GUILLEMOTLEFT = 0x00AB,
- NOTSIGN = 0x00AC,
- HYPHEN = 0x00AD,
- KEY_REGISTERED = 0x00AE, // "REGISTERED" is a reserved word on Windows.
- MACRON = 0x00AF,
- DEGREE = 0x00B0,
- PLUSMINUS = 0x00B1,
- TWOSUPERIOR = 0x00B2,
- THREESUPERIOR = 0x00B3,
- ACUTE = 0x00B4,
- MU = 0x00B5,
- PARAGRAPH = 0x00B6,
- PERIODCENTERED = 0x00B7,
- CEDILLA = 0x00B8,
- ONESUPERIOR = 0x00B9,
- MASCULINE = 0x00BA,
- GUILLEMOTRIGHT = 0x00BB,
- ONEQUARTER = 0x00BC,
- ONEHALF = 0x00BD,
- THREEQUARTERS = 0x00BE,
- QUESTIONDOWN = 0x00BF,
- AGRAVE = 0x00C0,
- AACUTE = 0x00C1,
- ACIRCUMFLEX = 0x00C2,
- ATILDE = 0x00C3,
- ADIAERESIS = 0x00C4,
- ARING = 0x00C5,
- AE = 0x00C6,
- CCEDILLA = 0x00C7,
- EGRAVE = 0x00C8,
- EACUTE = 0x00C9,
- ECIRCUMFLEX = 0x00CA,
- EDIAERESIS = 0x00CB,
- IGRAVE = 0x00CC,
- IACUTE = 0x00CD,
- ICIRCUMFLEX = 0x00CE,
- IDIAERESIS = 0x00CF,
- ETH = 0x00D0,
- NTILDE = 0x00D1,
- OGRAVE = 0x00D2,
- OACUTE = 0x00D3,
- OCIRCUMFLEX = 0x00D4,
- OTILDE = 0x00D5,
- ODIAERESIS = 0x00D6,
- MULTIPLY = 0x00D7,
- OOBLIQUE = 0x00D8,
- UGRAVE = 0x00D9,
- UACUTE = 0x00DA,
- UCIRCUMFLEX = 0x00DB,
- UDIAERESIS = 0x00DC,
- YACUTE = 0x00DD,
- THORN = 0x00DE,
- SSHARP = 0x00DF,
-
- DIVISION = 0x00F7,
- YDIAERESIS = 0x00FF,
- END_LATIN1 = 0x0100,
};
enum class KeyModifierMask {
@@ -402,4 +336,8 @@ int keycode_get_count();
int keycode_get_value_by_index(int p_index);
const char *keycode_get_name_by_index(int p_index);
+char32_t fix_unicode(char32_t p_char);
+Key fix_keycode(char32_t p_char, Key p_key);
+Key fix_key_label(char32_t p_char, Key p_key);
+
#endif // KEYBOARD_H