Explorar o código

Use "enum class" for input enums

Aaron Franke %!s(int64=4) %!d(string=hai) anos
pai
achega
3c0fdcc8ac
Modificáronse 100 ficheiros con 2343 adicións e 2254 borrados
  1. 4 4
      core/core_bind.cpp
  2. 3 3
      core/core_bind.h
  3. 331 320
      core/core_constants.cpp
  4. 92 88
      core/input/input.cpp
  5. 11 11
      core/input/input.h
  6. 112 72
      core/input/input_enums.h
  7. 78 78
      core/input/input_event.cpp
  8. 12 12
      core/input/input_event.h
  9. 86 86
      core/input/input_map.cpp
  10. 354 355
      core/os/keyboard.cpp
  11. 276 263
      core/os/keyboard.h
  12. 9 9
      core/os/midi_driver.cpp
  13. 1 1
      core/variant/binder_common.h
  14. 17 0
      core/variant/variant.h
  15. 7 7
      doc/classes/@GlobalScope.xml
  16. 1 1
      doc/classes/BaseButton.xml
  17. 1 1
      doc/classes/Input.xml
  18. 2 2
      doc/classes/InputEventKey.xml
  19. 1 1
      doc/classes/InputEventMouse.xml
  20. 2 2
      doc/classes/OS.xml
  21. 9 9
      doc/classes/PopupMenu.xml
  22. 15 15
      editor/action_map_editor.cpp
  23. 9 9
      editor/animation_bezier_editor.cpp
  24. 38 38
      editor/animation_track_editor.cpp
  25. 2 2
      editor/animation_track_editor_plugins.cpp
  26. 9 9
      editor/code_editor.cpp
  27. 4 4
      editor/create_dialog.cpp
  28. 1 1
      editor/debugger/editor_performance_profiler.cpp
  29. 2 2
      editor/debugger/editor_profiler.cpp
  30. 2 2
      editor/debugger/editor_visual_profiler.cpp
  31. 6 6
      editor/editor_audio_buses.cpp
  32. 4 4
      editor/editor_command_palette.cpp
  33. 1 1
      editor/editor_command_palette.h
  34. 15 15
      editor/editor_file_dialog.cpp
  35. 2 2
      editor/editor_help.cpp
  36. 4 4
      editor/editor_help_search.cpp
  37. 10 10
      editor/editor_inspector.cpp
  38. 3 3
      editor/editor_layouts_dialog.cpp
  39. 3 3
      editor/editor_log.cpp
  40. 57 57
      editor/editor_node.cpp
  41. 5 5
      editor/editor_properties.cpp
  42. 1 1
      editor/editor_resource_picker.cpp
  43. 8 9
      editor/editor_settings.cpp
  44. 2 2
      editor/editor_settings.h
  45. 12 10
      editor/editor_spin_slider.cpp
  46. 5 5
      editor/editor_zoom_widget.cpp
  47. 7 7
      editor/filesystem_dock.cpp
  48. 3 3
      editor/import/scene_import_settings.cpp
  49. 11 11
      editor/plugins/abstract_polygon_2d_editor.cpp
  50. 6 6
      editor/plugins/animation_blend_space_1d_editor.cpp
  51. 7 7
      editor/plugins/animation_blend_space_2d_editor.cpp
  52. 4 4
      editor/plugins/animation_player_editor_plugin.cpp
  53. 7 7
      editor/plugins/animation_state_machine_editor.cpp
  54. 1 1
      editor/plugins/asset_library_editor_plugin.cpp
  55. 2 2
      editor/plugins/audio_stream_editor_plugin.cpp
  56. 98 98
      editor/plugins/canvas_item_editor_plugin.cpp
  57. 6 6
      editor/plugins/collision_polygon_3d_editor_plugin.cpp
  58. 3 3
      editor/plugins/collision_shape_2d_editor_plugin.cpp
  59. 6 6
      editor/plugins/curve_editor_plugin.cpp
  60. 3 3
      editor/plugins/debugger_editor_plugin.cpp
  61. 1 1
      editor/plugins/mesh_editor_plugin.cpp
  62. 96 96
      editor/plugins/node_3d_editor_plugin.cpp
  63. 6 6
      editor/plugins/path_2d_editor_plugin.cpp
  64. 3 3
      editor/plugins/path_3d_editor_plugin.cpp
  65. 5 5
      editor/plugins/polygon_2d_editor_plugin.cpp
  66. 26 26
      editor/plugins/script_editor_plugin.cpp
  67. 44 44
      editor/plugins/script_text_editor.cpp
  68. 1 1
      editor/plugins/shader_editor_plugin.cpp
  69. 3 3
      editor/plugins/skeleton_3d_editor_plugin.cpp
  70. 8 8
      editor/plugins/sprite_frames_editor_plugin.cpp
  71. 1 1
      editor/plugins/text_editor.cpp
  72. 1 1
      editor/plugins/texture_layered_editor_plugin.cpp
  73. 6 6
      editor/plugins/texture_region_editor_plugin.cpp
  74. 3 3
      editor/plugins/theme_editor_plugin.cpp
  75. 1 1
      editor/plugins/theme_editor_preview.cpp
  76. 2 2
      editor/plugins/tiles/tile_atlas_view.cpp
  77. 11 11
      editor/plugins/tiles/tile_data_editors.cpp
  78. 39 39
      editor/plugins/tiles/tile_map_editor.cpp
  79. 8 8
      editor/plugins/tiles/tile_set_atlas_source_editor.cpp
  80. 1 1
      editor/plugins/version_control_editor_plugin.cpp
  81. 2 2
      editor/plugins/visual_shader_editor_plugin.cpp
  82. 15 15
      editor/project_manager.cpp
  83. 2 2
      editor/property_editor.cpp
  84. 4 4
      editor/property_selector.cpp
  85. 4 4
      editor/quick_open.cpp
  86. 19 19
      editor/scene_tree_dock.cpp
  87. 1 1
      editor/settings_config_dialog.cpp
  88. 31 31
      modules/gridmap/grid_map_editor_plugin.cpp
  89. 1 1
      modules/mono/csharp_script.cpp
  90. 2 2
      modules/mono/utils/mono_reg_utils.cpp
  91. 22 22
      modules/visual_script/editor/visual_script_editor.cpp
  92. 4 4
      modules/visual_script/editor/visual_script_property_selector.cpp
  93. 37 37
      platform/android/android_input_handler.cpp
  94. 3 3
      platform/android/android_input_handler.h
  95. 3 3
      platform/android/android_keys_utils.cpp
  96. 92 92
      platform/android/android_keys_utils.h
  97. 15 11
      platform/android/java_godot_lib_jni.cpp
  98. 1 1
      platform/iphone/display_server_iphone.mm
  99. 22 22
      platform/iphone/joypad_iphone.mm
  100. 4 4
      platform/iphone/keyboard_input_view.mm

+ 4 - 4
core/core_bind.cpp

@@ -502,15 +502,15 @@ String OS::get_system_dir(SystemDir p_dir, bool p_shared_storage) const {
 	return ::OS::get_singleton()->get_system_dir(::OS::SystemDir(p_dir), p_shared_storage);
 }
 
-String OS::get_keycode_string(uint32_t p_code) const {
+String OS::get_keycode_string(Key p_code) const {
 	return ::keycode_get_string(p_code);
 }
 
-bool OS::is_keycode_unicode(uint32_t p_unicode) const {
-	return ::keycode_has_unicode(p_unicode);
+bool OS::is_keycode_unicode(char32_t p_unicode) const {
+	return ::keycode_has_unicode((Key)p_unicode);
 }
 
-int OS::find_keycode_from_string(const String &p_code) const {
+Key OS::find_keycode_from_string(const String &p_code) const {
 	return find_keycode(p_code);
 }
 

+ 3 - 3
core/core_bind.h

@@ -195,9 +195,9 @@ public:
 
 	String get_unique_id() const;
 
-	String get_keycode_string(uint32_t p_code) const;
-	bool is_keycode_unicode(uint32_t p_unicode) const;
-	int find_keycode_from_string(const String &p_code) const;
+	String get_keycode_string(Key p_code) const;
+	bool is_keycode_unicode(char32_t p_unicode) const;
+	Key find_keycode_from_string(const String &p_code) const;
 
 	void set_use_file_access_save_and_swap(bool p_enable);
 

+ 331 - 320
core/core_constants.cpp

@@ -71,6 +71,16 @@ static Vector<_CoreConstant> _global_constants;
 #define BIND_CORE_ENUM_CONSTANT(m_constant) \
 	_global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_constant, #m_constant), #m_constant, m_constant));
 
+// This just binds enum classes as if they were regular enum constants.
+#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
+	_global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member), #m_prefix "_" #m_member, (int)m_enum::m_member));
+
+#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
+	_global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_enum::m_member, #m_name), #m_name, (int)m_enum::m_member));
+
+#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
+	_global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member), #m_prefix "_" #m_member, (int)m_enum::m_member, true));
+
 #define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
 	_global_constants.push_back(_CoreConstant(__constant_get_enum_name(m_constant, #m_constant), m_custom_name, m_constant));
 
@@ -91,6 +101,16 @@ static Vector<_CoreConstant> _global_constants;
 #define BIND_CORE_ENUM_CONSTANT(m_constant) \
 	_global_constants.push_back(_CoreConstant(#m_constant, m_constant));
 
+// This just binds enum classes as if they were regular enum constants.
+#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
+	_global_constants.push_back(_CoreConstant(#m_prefix "_" #m_member, (int)m_enum::m_member));
+
+#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
+	_global_constants.push_back(_CoreConstant(#m_name, (int)m_enum::m_member));
+
+#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
+	_global_constants.push_back(_CoreConstant(#m_prefix "_" #m_member, (int)m_enum::m_member));
+
 #define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
 	_global_constants.push_back(_CoreConstant(m_custom_name, m_constant));
 
@@ -144,326 +164,317 @@ void register_global_constants() {
 	BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_CENTER);
 	BIND_CORE_ENUM_CONSTANT(INLINE_ALIGN_BOTTOM);
 
-	// huge list of keys
-	BIND_CORE_CONSTANT(SPKEY);
-
-	BIND_CORE_ENUM_CONSTANT(KEY_ESCAPE);
-	BIND_CORE_ENUM_CONSTANT(KEY_TAB);
-	BIND_CORE_ENUM_CONSTANT(KEY_BACKTAB);
-	BIND_CORE_ENUM_CONSTANT(KEY_BACKSPACE);
-	BIND_CORE_ENUM_CONSTANT(KEY_ENTER);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_ENTER);
-	BIND_CORE_ENUM_CONSTANT(KEY_INSERT);
-	BIND_CORE_ENUM_CONSTANT(KEY_DELETE);
-	BIND_CORE_ENUM_CONSTANT(KEY_PAUSE);
-	BIND_CORE_ENUM_CONSTANT(KEY_PRINT);
-	BIND_CORE_ENUM_CONSTANT(KEY_SYSREQ);
-	BIND_CORE_ENUM_CONSTANT(KEY_CLEAR);
-	BIND_CORE_ENUM_CONSTANT(KEY_HOME);
-	BIND_CORE_ENUM_CONSTANT(KEY_END);
-	BIND_CORE_ENUM_CONSTANT(KEY_LEFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_UP);
-	BIND_CORE_ENUM_CONSTANT(KEY_RIGHT);
-	BIND_CORE_ENUM_CONSTANT(KEY_DOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_PAGEUP);
-	BIND_CORE_ENUM_CONSTANT(KEY_PAGEDOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_SHIFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_CTRL);
-	BIND_CORE_ENUM_CONSTANT(KEY_META);
-	BIND_CORE_ENUM_CONSTANT(KEY_ALT);
-	BIND_CORE_ENUM_CONSTANT(KEY_CAPSLOCK);
-	BIND_CORE_ENUM_CONSTANT(KEY_NUMLOCK);
-	BIND_CORE_ENUM_CONSTANT(KEY_SCROLLLOCK);
-	BIND_CORE_ENUM_CONSTANT(KEY_F1);
-	BIND_CORE_ENUM_CONSTANT(KEY_F2);
-	BIND_CORE_ENUM_CONSTANT(KEY_F3);
-	BIND_CORE_ENUM_CONSTANT(KEY_F4);
-	BIND_CORE_ENUM_CONSTANT(KEY_F5);
-	BIND_CORE_ENUM_CONSTANT(KEY_F6);
-	BIND_CORE_ENUM_CONSTANT(KEY_F7);
-	BIND_CORE_ENUM_CONSTANT(KEY_F8);
-	BIND_CORE_ENUM_CONSTANT(KEY_F9);
-	BIND_CORE_ENUM_CONSTANT(KEY_F10);
-	BIND_CORE_ENUM_CONSTANT(KEY_F11);
-	BIND_CORE_ENUM_CONSTANT(KEY_F12);
-	BIND_CORE_ENUM_CONSTANT(KEY_F13);
-	BIND_CORE_ENUM_CONSTANT(KEY_F14);
-	BIND_CORE_ENUM_CONSTANT(KEY_F15);
-	BIND_CORE_ENUM_CONSTANT(KEY_F16);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_MULTIPLY);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_DIVIDE);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_SUBTRACT);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_PERIOD);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_ADD);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_0);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_1);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_2);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_3);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_4);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_5);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_6);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_7);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_8);
-	BIND_CORE_ENUM_CONSTANT(KEY_KP_9);
-	BIND_CORE_ENUM_CONSTANT(KEY_SUPER_L);
-	BIND_CORE_ENUM_CONSTANT(KEY_SUPER_R);
-	BIND_CORE_ENUM_CONSTANT(KEY_MENU);
-	BIND_CORE_ENUM_CONSTANT(KEY_HYPER_L);
-	BIND_CORE_ENUM_CONSTANT(KEY_HYPER_R);
-	BIND_CORE_ENUM_CONSTANT(KEY_HELP);
-	BIND_CORE_ENUM_CONSTANT(KEY_DIRECTION_L);
-	BIND_CORE_ENUM_CONSTANT(KEY_DIRECTION_R);
-	BIND_CORE_ENUM_CONSTANT(KEY_BACK);
-	BIND_CORE_ENUM_CONSTANT(KEY_FORWARD);
-	BIND_CORE_ENUM_CONSTANT(KEY_STOP);
-	BIND_CORE_ENUM_CONSTANT(KEY_REFRESH);
-	BIND_CORE_ENUM_CONSTANT(KEY_VOLUMEDOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_VOLUMEMUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_VOLUMEUP);
-	BIND_CORE_ENUM_CONSTANT(KEY_BASSBOOST);
-	BIND_CORE_ENUM_CONSTANT(KEY_BASSUP);
-	BIND_CORE_ENUM_CONSTANT(KEY_BASSDOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_TREBLEUP);
-	BIND_CORE_ENUM_CONSTANT(KEY_TREBLEDOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_MEDIAPLAY);
-	BIND_CORE_ENUM_CONSTANT(KEY_MEDIASTOP);
-	BIND_CORE_ENUM_CONSTANT(KEY_MEDIAPREVIOUS);
-	BIND_CORE_ENUM_CONSTANT(KEY_MEDIANEXT);
-	BIND_CORE_ENUM_CONSTANT(KEY_MEDIARECORD);
-	BIND_CORE_ENUM_CONSTANT(KEY_HOMEPAGE);
-	BIND_CORE_ENUM_CONSTANT(KEY_FAVORITES);
-	BIND_CORE_ENUM_CONSTANT(KEY_SEARCH);
-	BIND_CORE_ENUM_CONSTANT(KEY_STANDBY);
-	BIND_CORE_ENUM_CONSTANT(KEY_OPENURL);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHMAIL);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHMEDIA);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH0);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH1);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH2);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH3);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH4);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH5);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH6);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH7);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH8);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCH9);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHA);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHB);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHC);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHD);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHE);
-	BIND_CORE_ENUM_CONSTANT(KEY_LAUNCHF);
-
-	BIND_CORE_ENUM_CONSTANT(KEY_UNKNOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_SPACE);
-	BIND_CORE_ENUM_CONSTANT(KEY_EXCLAM);
-	BIND_CORE_ENUM_CONSTANT(KEY_QUOTEDBL);
-	BIND_CORE_ENUM_CONSTANT(KEY_NUMBERSIGN);
-	BIND_CORE_ENUM_CONSTANT(KEY_DOLLAR);
-	BIND_CORE_ENUM_CONSTANT(KEY_PERCENT);
-	BIND_CORE_ENUM_CONSTANT(KEY_AMPERSAND);
-	BIND_CORE_ENUM_CONSTANT(KEY_APOSTROPHE);
-	BIND_CORE_ENUM_CONSTANT(KEY_PARENLEFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_PARENRIGHT);
-	BIND_CORE_ENUM_CONSTANT(KEY_ASTERISK);
-	BIND_CORE_ENUM_CONSTANT(KEY_PLUS);
-	BIND_CORE_ENUM_CONSTANT(KEY_COMMA);
-	BIND_CORE_ENUM_CONSTANT(KEY_MINUS);
-	BIND_CORE_ENUM_CONSTANT(KEY_PERIOD);
-	BIND_CORE_ENUM_CONSTANT(KEY_SLASH);
-	BIND_CORE_ENUM_CONSTANT(KEY_0);
-	BIND_CORE_ENUM_CONSTANT(KEY_1);
-	BIND_CORE_ENUM_CONSTANT(KEY_2);
-	BIND_CORE_ENUM_CONSTANT(KEY_3);
-	BIND_CORE_ENUM_CONSTANT(KEY_4);
-	BIND_CORE_ENUM_CONSTANT(KEY_5);
-	BIND_CORE_ENUM_CONSTANT(KEY_6);
-	BIND_CORE_ENUM_CONSTANT(KEY_7);
-	BIND_CORE_ENUM_CONSTANT(KEY_8);
-	BIND_CORE_ENUM_CONSTANT(KEY_9);
-	BIND_CORE_ENUM_CONSTANT(KEY_COLON);
-	BIND_CORE_ENUM_CONSTANT(KEY_SEMICOLON);
-	BIND_CORE_ENUM_CONSTANT(KEY_LESS);
-	BIND_CORE_ENUM_CONSTANT(KEY_EQUAL);
-	BIND_CORE_ENUM_CONSTANT(KEY_GREATER);
-	BIND_CORE_ENUM_CONSTANT(KEY_QUESTION);
-	BIND_CORE_ENUM_CONSTANT(KEY_AT);
-	BIND_CORE_ENUM_CONSTANT(KEY_A);
-	BIND_CORE_ENUM_CONSTANT(KEY_B);
-	BIND_CORE_ENUM_CONSTANT(KEY_C);
-	BIND_CORE_ENUM_CONSTANT(KEY_D);
-	BIND_CORE_ENUM_CONSTANT(KEY_E);
-	BIND_CORE_ENUM_CONSTANT(KEY_F);
-	BIND_CORE_ENUM_CONSTANT(KEY_G);
-	BIND_CORE_ENUM_CONSTANT(KEY_H);
-	BIND_CORE_ENUM_CONSTANT(KEY_I);
-	BIND_CORE_ENUM_CONSTANT(KEY_J);
-	BIND_CORE_ENUM_CONSTANT(KEY_K);
-	BIND_CORE_ENUM_CONSTANT(KEY_L);
-	BIND_CORE_ENUM_CONSTANT(KEY_M);
-	BIND_CORE_ENUM_CONSTANT(KEY_N);
-	BIND_CORE_ENUM_CONSTANT(KEY_O);
-	BIND_CORE_ENUM_CONSTANT(KEY_P);
-	BIND_CORE_ENUM_CONSTANT(KEY_Q);
-	BIND_CORE_ENUM_CONSTANT(KEY_R);
-	BIND_CORE_ENUM_CONSTANT(KEY_S);
-	BIND_CORE_ENUM_CONSTANT(KEY_T);
-	BIND_CORE_ENUM_CONSTANT(KEY_U);
-	BIND_CORE_ENUM_CONSTANT(KEY_V);
-	BIND_CORE_ENUM_CONSTANT(KEY_W);
-	BIND_CORE_ENUM_CONSTANT(KEY_X);
-	BIND_CORE_ENUM_CONSTANT(KEY_Y);
-	BIND_CORE_ENUM_CONSTANT(KEY_Z);
-	BIND_CORE_ENUM_CONSTANT(KEY_BRACKETLEFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_BACKSLASH);
-	BIND_CORE_ENUM_CONSTANT(KEY_BRACKETRIGHT);
-	BIND_CORE_ENUM_CONSTANT(KEY_ASCIICIRCUM);
-	BIND_CORE_ENUM_CONSTANT(KEY_UNDERSCORE);
-	BIND_CORE_ENUM_CONSTANT(KEY_QUOTELEFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_BRACELEFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_BAR);
-	BIND_CORE_ENUM_CONSTANT(KEY_BRACERIGHT);
-	BIND_CORE_ENUM_CONSTANT(KEY_ASCIITILDE);
-	BIND_CORE_ENUM_CONSTANT(KEY_NOBREAKSPACE);
-	BIND_CORE_ENUM_CONSTANT(KEY_EXCLAMDOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_CENT);
-	BIND_CORE_ENUM_CONSTANT(KEY_STERLING);
-	BIND_CORE_ENUM_CONSTANT(KEY_CURRENCY);
-	BIND_CORE_ENUM_CONSTANT(KEY_YEN);
-	BIND_CORE_ENUM_CONSTANT(KEY_BROKENBAR);
-	BIND_CORE_ENUM_CONSTANT(KEY_SECTION);
-	BIND_CORE_ENUM_CONSTANT(KEY_DIAERESIS);
-	BIND_CORE_ENUM_CONSTANT(KEY_COPYRIGHT);
-	BIND_CORE_ENUM_CONSTANT(KEY_ORDFEMININE);
-	BIND_CORE_ENUM_CONSTANT(KEY_GUILLEMOTLEFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_NOTSIGN);
-	BIND_CORE_ENUM_CONSTANT(KEY_HYPHEN);
-	BIND_CORE_ENUM_CONSTANT(KEY_REGISTERED);
-	BIND_CORE_ENUM_CONSTANT(KEY_MACRON);
-	BIND_CORE_ENUM_CONSTANT(KEY_DEGREE);
-	BIND_CORE_ENUM_CONSTANT(KEY_PLUSMINUS);
-	BIND_CORE_ENUM_CONSTANT(KEY_TWOSUPERIOR);
-	BIND_CORE_ENUM_CONSTANT(KEY_THREESUPERIOR);
-	BIND_CORE_ENUM_CONSTANT(KEY_ACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_MU);
-	BIND_CORE_ENUM_CONSTANT(KEY_PARAGRAPH);
-	BIND_CORE_ENUM_CONSTANT(KEY_PERIODCENTERED);
-	BIND_CORE_ENUM_CONSTANT(KEY_CEDILLA);
-	BIND_CORE_ENUM_CONSTANT(KEY_ONESUPERIOR);
-	BIND_CORE_ENUM_CONSTANT(KEY_MASCULINE);
-	BIND_CORE_ENUM_CONSTANT(KEY_GUILLEMOTRIGHT);
-	BIND_CORE_ENUM_CONSTANT(KEY_ONEQUARTER);
-	BIND_CORE_ENUM_CONSTANT(KEY_ONEHALF);
-	BIND_CORE_ENUM_CONSTANT(KEY_THREEQUARTERS);
-	BIND_CORE_ENUM_CONSTANT(KEY_QUESTIONDOWN);
-	BIND_CORE_ENUM_CONSTANT(KEY_AGRAVE);
-	BIND_CORE_ENUM_CONSTANT(KEY_AACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_ACIRCUMFLEX);
-	BIND_CORE_ENUM_CONSTANT(KEY_ATILDE);
-	BIND_CORE_ENUM_CONSTANT(KEY_ADIAERESIS);
-	BIND_CORE_ENUM_CONSTANT(KEY_ARING);
-	BIND_CORE_ENUM_CONSTANT(KEY_AE);
-	BIND_CORE_ENUM_CONSTANT(KEY_CCEDILLA);
-	BIND_CORE_ENUM_CONSTANT(KEY_EGRAVE);
-	BIND_CORE_ENUM_CONSTANT(KEY_EACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_ECIRCUMFLEX);
-	BIND_CORE_ENUM_CONSTANT(KEY_EDIAERESIS);
-	BIND_CORE_ENUM_CONSTANT(KEY_IGRAVE);
-	BIND_CORE_ENUM_CONSTANT(KEY_IACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_ICIRCUMFLEX);
-	BIND_CORE_ENUM_CONSTANT(KEY_IDIAERESIS);
-	BIND_CORE_ENUM_CONSTANT(KEY_ETH);
-	BIND_CORE_ENUM_CONSTANT(KEY_NTILDE);
-	BIND_CORE_ENUM_CONSTANT(KEY_OGRAVE);
-	BIND_CORE_ENUM_CONSTANT(KEY_OACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_OCIRCUMFLEX);
-	BIND_CORE_ENUM_CONSTANT(KEY_OTILDE);
-	BIND_CORE_ENUM_CONSTANT(KEY_ODIAERESIS);
-	BIND_CORE_ENUM_CONSTANT(KEY_MULTIPLY);
-	BIND_CORE_ENUM_CONSTANT(KEY_OOBLIQUE);
-	BIND_CORE_ENUM_CONSTANT(KEY_UGRAVE);
-	BIND_CORE_ENUM_CONSTANT(KEY_UACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_UCIRCUMFLEX);
-	BIND_CORE_ENUM_CONSTANT(KEY_UDIAERESIS);
-	BIND_CORE_ENUM_CONSTANT(KEY_YACUTE);
-	BIND_CORE_ENUM_CONSTANT(KEY_THORN);
-	BIND_CORE_ENUM_CONSTANT(KEY_SSHARP);
-
-	BIND_CORE_ENUM_CONSTANT(KEY_DIVISION);
-	BIND_CORE_ENUM_CONSTANT(KEY_YDIAERESIS);
-
-	BIND_CORE_ENUM_CONSTANT(KEY_CODE_MASK);
-	BIND_CORE_ENUM_CONSTANT(KEY_MODIFIER_MASK);
-
-	BIND_CORE_ENUM_CONSTANT(KEY_MASK_SHIFT);
-	BIND_CORE_ENUM_CONSTANT(KEY_MASK_ALT);
-	BIND_CORE_ENUM_CONSTANT(KEY_MASK_META);
-	BIND_CORE_ENUM_CONSTANT(KEY_MASK_CTRL);
-	BIND_CORE_ENUM_CONSTANT_NO_VAL(KEY_MASK_CMD);
-	BIND_CORE_ENUM_CONSTANT(KEY_MASK_KPAD);
-	BIND_CORE_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
-
-	// mouse
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_LEFT);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_RIGHT);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MIDDLE);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON1);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON2);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_UP);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_DOWN);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_LEFT);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_RIGHT);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_LEFT);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_RIGHT);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_MIDDLE);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON1);
-	BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON2);
-
-	// Joypad buttons
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_A);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_B);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_X);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_Y);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_BACK);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_GUIDE);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_START);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_LEFT_STICK);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_RIGHT_STICK);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_LEFT_SHOULDER);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_RIGHT_SHOULDER);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_UP);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_DOWN);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_LEFT);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_DPAD_RIGHT);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_MISC1);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_PADDLE1);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_PADDLE2);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_PADDLE3);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_PADDLE4);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_TOUCHPAD);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_SDL_MAX);
-	BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_MAX);
-
-	// Joypad axes
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_INVALID);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_X);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_LEFT_Y);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_X);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_RIGHT_Y);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_LEFT);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_TRIGGER_RIGHT);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_SDL_MAX);
-	BIND_CORE_ENUM_CONSTANT(JOY_AXIS_MAX);
-
-	// midi
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_OFF);
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_NOTE_ON);
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_AFTERTOUCH);
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_CONTROL_CHANGE);
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_PROGRAM_CHANGE);
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_CHANNEL_PRESSURE);
-	BIND_CORE_ENUM_CONSTANT(MIDI_MESSAGE_PITCH_BEND);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPECIAL);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ESCAPE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TAB);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKTAB);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKSPACE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ENTER);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_ENTER);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, INSERT);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_DELETE, KEY_DELETE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAUSE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PRINT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SYSREQ);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CLEAR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HOME);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, END);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, RIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAGEUP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAGEDOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SHIFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CTRL);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, META);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ALT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CAPSLOCK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NUMLOCK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SCROLLLOCK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F1);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F2);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F3);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F4);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F5);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F6);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F7);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F8);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F9);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F10);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F11);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F12);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F13);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F14);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F15);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F16);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_MULTIPLY);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_DIVIDE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_SUBTRACT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_PERIOD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_ADD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_0);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_1);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_2);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_3);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_4);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_5);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_6);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_7);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_8);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_9);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SUPER_L);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SUPER_R);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MENU);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER_L);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER_R);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HELP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIRECTION_L);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIRECTION_R);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FORWARD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STOP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, REFRESH);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEDOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEMUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEUP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BASSBOOST);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BASSUP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BASSDOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TREBLEUP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TREBLEDOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPLAY);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIASTOP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPREVIOUS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIANEXT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIARECORD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HOMEPAGE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FAVORITES);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SEARCH);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STANDBY);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OPENURL);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHMAIL);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHMEDIA);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH0);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH1);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH2);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH3);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH4);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH5);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH6);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH7);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH8);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH9);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHA);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHB);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHC);
+	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, UNKNOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPACE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EXCLAM);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUOTEDBL);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NUMBERSIGN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DOLLAR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERCENT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AMPERSAND);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, APOSTROPHE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARENLEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARENRIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASTERISK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PLUS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COMMA);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MINUS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERIOD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SLASH);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_0, KEY_0);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_1, KEY_1);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_2, KEY_2);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_3, KEY_3);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_4, KEY_4);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_5, KEY_5);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_6, KEY_6);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_7, KEY_7);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_8, KEY_8);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_9, KEY_9);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COLON);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SEMICOLON);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LESS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EQUAL);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GREATER);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUESTION);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, A);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, B);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, C);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, D);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, E);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, G);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, H);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, I);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, J);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, K);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, L);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, M);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, N);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, O);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, P);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Q);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, R);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, S);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, T);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, U);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, V);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, W);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, X);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Y);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Z);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACKETLEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKSLASH);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACKETRIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIICIRCUM);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UNDERSCORE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUOTELEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACELEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BAR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACERIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIITILDE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NOBREAKSPACE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EXCLAMDOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CENT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STERLING);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CURRENCY);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YEN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BROKENBAR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SECTION);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIAERESIS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COPYRIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ORDFEMININE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GUILLEMOTLEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NOTSIGN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPHEN);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_REGISTERED, KEY_REGISTERED);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MACRON);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DEGREE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PLUSMINUS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TWOSUPERIOR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, THREESUPERIOR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MU);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARAGRAPH);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERIODCENTERED);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CEDILLA);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ONESUPERIOR);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MASCULINE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GUILLEMOTRIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ONEQUARTER);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ONEHALF);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, THREEQUARTERS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUESTIONDOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AGRAVE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ACIRCUMFLEX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ATILDE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ADIAERESIS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ARING);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CCEDILLA);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EGRAVE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ECIRCUMFLEX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EDIAERESIS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, IGRAVE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, IACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ICIRCUMFLEX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, IDIAERESIS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ETH);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NTILDE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OGRAVE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OCIRCUMFLEX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OTILDE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ODIAERESIS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MULTIPLY);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OOBLIQUE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UGRAVE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UCIRCUMFLEX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UDIAERESIS);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YACUTE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, THORN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SSHARP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DIVISION);
+	BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YDIAERESIS);
+
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(KeyModifierMask, KEY_CODE_MASK, CODE_MASK);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(KeyModifierMask, KEY_MODIFIER_MASK, MODIFIER_MASK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, SHIFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, ALT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, META);
+	BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, CTRL);
+	BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(KeyModifierMask, KEY_MASK, CMD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, KPAD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(KeyModifierMask, KEY_MASK, GROUP_SWITCH);
+
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, LEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, RIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MIDDLE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_UP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_DOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_LEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_RIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(MouseButton, MOUSE_BUTTON_XBUTTON1, MB_XBUTTON1);
+	BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(MouseButton, MOUSE_BUTTON_XBUTTON2, MB_XBUTTON2);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MASK_LEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MASK_RIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MASK_MIDDLE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MASK_XBUTTON1);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MASK_XBUTTON2);
+
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, INVALID);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, A);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, B);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, X);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, Y);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, BACK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, GUIDE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, START);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, LEFT_STICK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, RIGHT_STICK);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, LEFT_SHOULDER);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, RIGHT_SHOULDER);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_UP);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_DOWN);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_LEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_RIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC1);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE1);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE2);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE3);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE4);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, TOUCHPAD);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, SDL_MAX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MAX);
+
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, INVALID);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, LEFT_X);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, LEFT_Y);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, RIGHT_X);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, RIGHT_Y);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, TRIGGER_LEFT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, TRIGGER_RIGHT);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, SDL_MAX);
+	BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, MAX);
+
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NOTE_OFF);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NOTE_ON);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, AFTERTOUCH);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CONTROL_CHANGE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, PROGRAM_CHANGE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CHANNEL_PRESSURE);
+	BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, PITCH_BEND);
 
 	// error list
 

+ 92 - 88
core/input/input.cpp

@@ -35,7 +35,7 @@
 #include "core/input/input_map.h"
 #include "core/os/os.h"
 
-static const char *_joy_buttons[JOY_BUTTON_SDL_MAX] = {
+static const char *_joy_buttons[(size_t)JoyButton::SDL_MAX] = {
 	"a",
 	"b",
 	"x",
@@ -59,7 +59,7 @@ static const char *_joy_buttons[JOY_BUTTON_SDL_MAX] = {
 	"touchpad",
 };
 
-static const char *_joy_axes[JOY_AXIS_SDL_MAX] = {
+static const char *_joy_axes[(size_t)JoyAxis::SDL_MAX] = {
 	"leftx",
 	"lefty",
 	"rightx",
@@ -225,11 +225,15 @@ bool Input::is_key_pressed(Key p_keycode) const {
 
 bool Input::is_mouse_button_pressed(MouseButton p_button) const {
 	_THREAD_SAFE_METHOD_
-	return (mouse_button_mask & (1 << (p_button - 1))) != 0;
+	return (mouse_button_mask & mouse_button_to_mask(p_button)) != MouseButton::NONE;
 }
 
-static int _combine_device(int p_value, int p_device) {
-	return p_value | (p_device << 20);
+static JoyAxis _combine_device(JoyAxis p_value, int p_device) {
+	return JoyAxis((int)p_value | (p_device << 20));
+}
+
+static JoyButton _combine_device(JoyButton p_value, int p_device) {
+	return JoyButton((int)p_value | (p_device << 20));
 }
 
 bool Input::is_joy_button_pressed(int p_device, JoyButton p_button) const {
@@ -338,7 +342,7 @@ Vector2 Input::get_vector(const StringName &p_negative_x, const StringName &p_po
 
 float Input::get_joy_axis(int p_device, JoyAxis p_axis) const {
 	_THREAD_SAFE_METHOD_
-	int c = _combine_device(p_axis, p_device);
+	JoyAxis c = _combine_device(p_axis, p_device);
 	if (_joy_axis.has(c)) {
 		return _joy_axis[c];
 	} else {
@@ -412,11 +416,11 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S
 		js.mapping = mapping;
 	} else {
 		js.connected = false;
-		for (int i = 0; i < JOY_BUTTON_MAX; i++) {
-			int c = _combine_device(i, p_idx);
+		for (int i = 0; i < (int)JoyButton::MAX; i++) {
+			JoyButton c = _combine_device((JoyButton)i, p_idx);
 			joy_buttons_pressed.erase(c);
 		}
-		for (int i = 0; i < JOY_AXIS_MAX; i++) {
+		for (int i = 0; i < (int)JoyAxis::MAX; i++) {
 			set_joy_axis(p_idx, (JoyAxis)i, 0.0f);
 		}
 	}
@@ -454,7 +458,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 	//   require additional handling by this class.
 
 	Ref<InputEventKey> k = p_event;
-	if (k.is_valid() && !k->is_echo() && k->get_keycode() != 0) {
+	if (k.is_valid() && !k->is_echo() && k->get_keycode() != Key::NONE) {
 		if (k->is_pressed()) {
 			keys_pressed.insert(k->get_keycode());
 		} else {
@@ -466,9 +470,9 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 
 	if (mb.is_valid()) {
 		if (mb->is_pressed()) {
-			mouse_button_mask |= (MouseButton)(1 << (mb->get_button_index() - 1));
+			mouse_button_mask |= mouse_button_to_mask(mb->get_button_index());
 		} else {
-			mouse_button_mask &= (MouseButton) ~(1 << (mb->get_button_index() - 1));
+			mouse_button_mask &= ~mouse_button_to_mask(mb->get_button_index());
 		}
 
 		Point2 pos = mb->get_global_position();
@@ -476,7 +480,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 			set_mouse_position(pos);
 		}
 
-		if (event_dispatch_function && emulate_touch_from_mouse && !p_is_emulated && mb->get_button_index() == 1) {
+		if (event_dispatch_function && emulate_touch_from_mouse && !p_is_emulated && mb->get_button_index() == MouseButton::LEFT) {
 			Ref<InputEventScreenTouch> touch_event;
 			touch_event.instantiate();
 			touch_event->set_pressed(mb->is_pressed());
@@ -493,7 +497,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 			set_mouse_position(pos);
 		}
 
-		if (event_dispatch_function && emulate_touch_from_mouse && !p_is_emulated && mm->get_button_mask() & 1) {
+		if (event_dispatch_function && emulate_touch_from_mouse && !p_is_emulated && (mm->get_button_mask() & MouseButton::LEFT) != MouseButton::NONE) {
 			Ref<InputEventScreenDrag> drag_event;
 			drag_event.instantiate();
 
@@ -539,11 +543,11 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 				button_event->set_position(st->get_position());
 				button_event->set_global_position(st->get_position());
 				button_event->set_pressed(st->is_pressed());
-				button_event->set_button_index(MOUSE_BUTTON_LEFT);
+				button_event->set_button_index(MouseButton::LEFT);
 				if (st->is_pressed()) {
-					button_event->set_button_mask(MouseButton(mouse_button_mask | MOUSE_BUTTON_MASK_LEFT));
+					button_event->set_button_mask(MouseButton(mouse_button_mask | MouseButton::MASK_LEFT));
 				} else {
-					button_event->set_button_mask(MouseButton(mouse_button_mask & ~MOUSE_BUTTON_MASK_LEFT));
+					button_event->set_button_mask(MouseButton(mouse_button_mask & ~MouseButton::MASK_LEFT));
 				}
 
 				_parse_input_event_impl(button_event, true);
@@ -576,7 +580,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 	Ref<InputEventJoypadButton> jb = p_event;
 
 	if (jb.is_valid()) {
-		int c = _combine_device(jb->get_button_index(), jb->get_device());
+		JoyButton c = _combine_device(jb->get_button_index(), jb->get_device());
 
 		if (jb->is_pressed()) {
 			joy_buttons_pressed.insert(c);
@@ -624,7 +628,7 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 
 void Input::set_joy_axis(int p_device, JoyAxis p_axis, float p_value) {
 	_THREAD_SAFE_METHOD_
-	int c = _combine_device(p_axis, p_device);
+	JoyAxis c = _combine_device(p_axis, p_device);
 	_joy_axis[c] = p_value;
 }
 
@@ -692,7 +696,7 @@ Point2 Input::get_last_mouse_speed() const {
 	return mouse_speed_track.speed;
 }
 
-int Input::get_mouse_button_mask() const {
+MouseButton Input::get_mouse_button_mask() const {
 	return mouse_button_mask; // do not trust OS implementation, should remove it - OS::get_singleton()->get_mouse_button_state();
 }
 
@@ -771,8 +775,8 @@ void Input::ensure_touch_mouse_raised() {
 		button_event->set_position(mouse_pos);
 		button_event->set_global_position(mouse_pos);
 		button_event->set_pressed(false);
-		button_event->set_button_index(MOUSE_BUTTON_LEFT);
-		button_event->set_button_mask(MouseButton(mouse_button_mask & ~MOUSE_BUTTON_MASK_LEFT));
+		button_event->set_button_index(MouseButton::LEFT);
+		button_event->set_button_mask(MouseButton(mouse_button_mask & ~MouseButton::MASK_LEFT));
 
 		_parse_input_event_impl(button_event, true);
 	}
@@ -876,10 +880,10 @@ void Input::joy_button(int p_device, JoyButton p_button, bool p_pressed) {
 	_THREAD_SAFE_METHOD_;
 	Joypad &joy = joy_names[p_device];
 	//printf("got button %i, mapping is %i\n", p_button, joy.mapping);
-	if (joy.last_buttons[p_button] == p_pressed) {
+	if (joy.last_buttons[(size_t)p_button] == p_pressed) {
 		return;
 	}
-	joy.last_buttons[p_button] = p_pressed;
+	joy.last_buttons[(size_t)p_button] = p_pressed;
 	if (joy.mapping == -1) {
 		_button_event(p_device, p_button, p_pressed);
 		return;
@@ -901,16 +905,16 @@ void Input::joy_button(int p_device, JoyButton p_button, bool p_pressed) {
 void Input::joy_axis(int p_device, JoyAxis p_axis, const JoyAxisValue &p_value) {
 	_THREAD_SAFE_METHOD_;
 
-	ERR_FAIL_INDEX(p_axis, JOY_AXIS_MAX);
+	ERR_FAIL_INDEX((int)p_axis, (int)JoyAxis::MAX);
 
 	Joypad &joy = joy_names[p_device];
 
-	if (joy.last_axis[p_axis] == p_value.value) {
+	if (joy.last_axis[(size_t)p_axis] == p_value.value) {
 		return;
 	}
 
 	//when changing direction quickly, insert fake event to release pending inputmap actions
-	float last = joy.last_axis[p_axis];
+	float last = joy.last_axis[(size_t)p_axis];
 	if (p_value.min == 0 && (last < 0.25 || last > 0.75) && (last - 0.5) * (p_value.value - 0.5) < 0) {
 		JoyAxisValue jx;
 		jx.min = p_value.min;
@@ -923,7 +927,7 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, const JoyAxisValue &p_value)
 		joy_axis(p_device, p_axis, jx);
 	}
 
-	joy.last_axis[p_axis] = p_value.value;
+	joy.last_axis[(size_t)p_axis] = p_value.value;
 	float val = p_value.min == 0 ? -1.0f + 2.0f * p_value.value : p_value.value;
 
 	if (joy.mapping == -1) {
@@ -935,32 +939,32 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, const JoyAxisValue &p_value)
 
 	if (map.type == TYPE_BUTTON) {
 		bool pressed = map.value > 0.5;
-		if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
+		if (pressed == joy_buttons_pressed.has(_combine_device((JoyButton)map.index, p_device))) {
 			// Button already pressed or released; so ignore.
 			return;
 		}
 		_button_event(p_device, (JoyButton)map.index, pressed);
 
 		// Ensure opposite D-Pad button is also released.
-		switch (map.index) {
-			case JOY_BUTTON_DPAD_UP:
-				if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_DOWN, p_device))) {
-					_button_event(p_device, JOY_BUTTON_DPAD_DOWN, false);
+		switch ((JoyButton)map.index) {
+			case JoyButton::DPAD_UP:
+				if (joy_buttons_pressed.has(_combine_device(JoyButton::DPAD_DOWN, p_device))) {
+					_button_event(p_device, JoyButton::DPAD_DOWN, false);
 				}
 				break;
-			case JOY_BUTTON_DPAD_DOWN:
-				if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_UP, p_device))) {
-					_button_event(p_device, JOY_BUTTON_DPAD_UP, false);
+			case JoyButton::DPAD_DOWN:
+				if (joy_buttons_pressed.has(_combine_device(JoyButton::DPAD_UP, p_device))) {
+					_button_event(p_device, JoyButton::DPAD_UP, false);
 				}
 				break;
-			case JOY_BUTTON_DPAD_LEFT:
-				if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_RIGHT, p_device))) {
-					_button_event(p_device, JOY_BUTTON_DPAD_RIGHT, false);
+			case JoyButton::DPAD_LEFT:
+				if (joy_buttons_pressed.has(_combine_device(JoyButton::DPAD_RIGHT, p_device))) {
+					_button_event(p_device, JoyButton::DPAD_RIGHT, false);
 				}
 				break;
-			case JOY_BUTTON_DPAD_RIGHT:
-				if (joy_buttons_pressed.has(_combine_device(JOY_BUTTON_DPAD_LEFT, p_device))) {
-					_button_event(p_device, JOY_BUTTON_DPAD_LEFT, false);
+			case JoyButton::DPAD_RIGHT:
+				if (joy_buttons_pressed.has(_combine_device(JoyButton::DPAD_LEFT, p_device))) {
+					_button_event(p_device, JoyButton::DPAD_LEFT, false);
 				}
 				break;
 			default:
@@ -977,27 +981,27 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, const JoyAxisValue &p_value)
 	//printf("invalid mapping\n");
 }
 
-void Input::joy_hat(int p_device, int p_val) {
+void Input::joy_hat(int p_device, HatMask p_val) {
 	_THREAD_SAFE_METHOD_;
 	const Joypad &joy = joy_names[p_device];
 
-	JoyEvent map[HAT_MAX];
+	JoyEvent map[(size_t)HatDir::MAX];
 
-	map[HatDir::HAT_UP].type = TYPE_BUTTON;
-	map[HatDir::HAT_UP].index = JOY_BUTTON_DPAD_UP;
-	map[HatDir::HAT_UP].value = 0;
+	map[(size_t)HatDir::UP].type = TYPE_BUTTON;
+	map[(size_t)HatDir::UP].index = (int)JoyButton::DPAD_UP;
+	map[(size_t)HatDir::UP].value = 0;
 
-	map[HatDir::HAT_RIGHT].type = TYPE_BUTTON;
-	map[HatDir::HAT_RIGHT].index = JOY_BUTTON_DPAD_RIGHT;
-	map[HatDir::HAT_RIGHT].value = 0;
+	map[(size_t)HatDir::RIGHT].type = TYPE_BUTTON;
+	map[(size_t)HatDir::RIGHT].index = (int)JoyButton::DPAD_RIGHT;
+	map[(size_t)HatDir::RIGHT].value = 0;
 
-	map[HatDir::HAT_DOWN].type = TYPE_BUTTON;
-	map[HatDir::HAT_DOWN].index = JOY_BUTTON_DPAD_DOWN;
-	map[HatDir::HAT_DOWN].value = 0;
+	map[(size_t)HatDir::DOWN].type = TYPE_BUTTON;
+	map[(size_t)HatDir::DOWN].index = (int)JoyButton::DPAD_DOWN;
+	map[(size_t)HatDir::DOWN].value = 0;
 
-	map[HatDir::HAT_LEFT].type = TYPE_BUTTON;
-	map[HatDir::HAT_LEFT].index = JOY_BUTTON_DPAD_LEFT;
-	map[HatDir::HAT_LEFT].value = 0;
+	map[(size_t)HatDir::LEFT].type = TYPE_BUTTON;
+	map[(size_t)HatDir::LEFT].index = (int)JoyButton::DPAD_LEFT;
+	map[(size_t)HatDir::LEFT].value = 0;
 
 	if (joy.mapping != -1) {
 		_get_mapped_hat_events(map_db[joy.mapping], (HatDir)0, map);
@@ -1005,18 +1009,18 @@ void Input::joy_hat(int p_device, int p_val) {
 
 	int cur_val = joy_names[p_device].hat_current;
 
-	for (int hat_direction = 0, hat_mask = 1; hat_direction < HAT_MAX; hat_direction++, hat_mask <<= 1) {
-		if ((p_val & hat_mask) != (cur_val & hat_mask)) {
+	for (int hat_direction = 0, hat_mask = 1; hat_direction < (int)HatDir::MAX; hat_direction++, hat_mask <<= 1) {
+		if (((int)p_val & hat_mask) != (cur_val & hat_mask)) {
 			if (map[hat_direction].type == TYPE_BUTTON) {
-				_button_event(p_device, (JoyButton)map[hat_direction].index, p_val & hat_mask);
+				_button_event(p_device, (JoyButton)map[hat_direction].index, (int)p_val & hat_mask);
 			}
 			if (map[hat_direction].type == TYPE_AXIS) {
-				_axis_event(p_device, (JoyAxis)map[hat_direction].index, (p_val & hat_mask) ? map[hat_direction].value : 0.0);
+				_axis_event(p_device, (JoyAxis)map[hat_direction].index, ((int)p_val & hat_mask) ? map[hat_direction].value : 0.0);
 			}
 		}
 	}
 
-	joy_names[p_device].hat_current = p_val;
+	joy_names[p_device].hat_current = (int)p_val;
 }
 
 void Input::_button_event(int p_device, JoyButton p_index, bool p_pressed) {
@@ -1049,10 +1053,10 @@ Input::JoyEvent Input::_get_mapped_button_event(const JoyDeviceMapping &mapping,
 			event.type = binding.outputType;
 			switch (binding.outputType) {
 				case TYPE_BUTTON:
-					event.index = binding.output.button;
+					event.index = (int)binding.output.button;
 					return event;
 				case TYPE_AXIS:
-					event.index = binding.output.axis.axis;
+					event.index = (int)binding.output.axis.axis;
 					switch (binding.output.axis.range) {
 						case POSITIVE_HALF_AXIS:
 							event.value = 1;
@@ -1104,7 +1108,7 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J
 				}
 				switch (binding.outputType) {
 					case TYPE_BUTTON:
-						event.index = binding.output.button;
+						event.index = (int)binding.output.button;
 						switch (binding.input.axis.range) {
 							case POSITIVE_HALF_AXIS:
 								event.value = shifted_positive_value;
@@ -1121,7 +1125,7 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J
 						}
 						return event;
 					case TYPE_AXIS:
-						event.index = binding.output.axis.axis;
+						event.index = (int)binding.output.axis.axis;
 						event.value = value;
 						if (binding.output.axis.range != binding.input.axis.range) {
 							switch (binding.output.axis.range) {
@@ -1150,43 +1154,43 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat
 	for (int i = 0; i < mapping.bindings.size(); i++) {
 		const JoyBinding binding = mapping.bindings[i];
 		if (binding.inputType == TYPE_HAT && binding.input.hat.hat == p_hat) {
-			int hat_direction;
+			HatDir hat_direction;
 			switch (binding.input.hat.hat_mask) {
-				case HatMask::HAT_MASK_UP:
-					hat_direction = HatDir::HAT_UP;
+				case HatMask::UP:
+					hat_direction = HatDir::UP;
 					break;
-				case HatMask::HAT_MASK_RIGHT:
-					hat_direction = HatDir::HAT_RIGHT;
+				case HatMask::RIGHT:
+					hat_direction = HatDir::RIGHT;
 					break;
-				case HatMask::HAT_MASK_DOWN:
-					hat_direction = HatDir::HAT_DOWN;
+				case HatMask::DOWN:
+					hat_direction = HatDir::DOWN;
 					break;
-				case HatMask::HAT_MASK_LEFT:
-					hat_direction = HatDir::HAT_LEFT;
+				case HatMask::LEFT:
+					hat_direction = HatDir::LEFT;
 					break;
 				default:
 					ERR_PRINT_ONCE("Joypad button mapping error.");
 					continue;
 			}
 
-			r_events[hat_direction].type = binding.outputType;
+			r_events[(size_t)hat_direction].type = binding.outputType;
 			switch (binding.outputType) {
 				case TYPE_BUTTON:
-					r_events[hat_direction].index = binding.output.button;
+					r_events[(size_t)hat_direction].index = (int)binding.output.button;
 					break;
 				case TYPE_AXIS:
-					r_events[hat_direction].index = binding.output.axis.axis;
+					r_events[(size_t)hat_direction].index = (int)binding.output.axis.axis;
 					switch (binding.output.axis.range) {
 						case POSITIVE_HALF_AXIS:
-							r_events[hat_direction].value = 1;
+							r_events[(size_t)hat_direction].value = 1;
 							break;
 						case NEGATIVE_HALF_AXIS:
-							r_events[hat_direction].value = -1;
+							r_events[(size_t)hat_direction].value = -1;
 							break;
 						case FULL_AXIS:
 							// It doesn't make sense for a hat direction to map to a full axis,
 							// but keeping as a default for a trigger with a positive half-axis.
-							r_events[hat_direction].value = 1;
+							r_events[(size_t)hat_direction].value = 1;
 							break;
 					}
 					break;
@@ -1198,21 +1202,21 @@ void Input::_get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat
 }
 
 JoyButton Input::_get_output_button(String output) {
-	for (int i = 0; i < JOY_BUTTON_SDL_MAX; i++) {
+	for (int i = 0; i < (int)JoyButton::SDL_MAX; i++) {
 		if (output == _joy_buttons[i]) {
 			return JoyButton(i);
 		}
 	}
-	return JoyButton::JOY_BUTTON_INVALID;
+	return JoyButton::INVALID;
 }
 
 JoyAxis Input::_get_output_axis(String output) {
-	for (int i = 0; i < JOY_AXIS_SDL_MAX; i++) {
+	for (int i = 0; i < (int)JoyAxis::SDL_MAX; i++) {
 		if (output == _joy_axes[i]) {
 			return JoyAxis(i);
 		}
 	}
-	return JoyAxis::JOY_AXIS_INVALID;
+	return JoyAxis::INVALID;
 }
 
 void Input::parse_mapping(String p_mapping) {
@@ -1273,16 +1277,16 @@ void Input::parse_mapping(String p_mapping) {
 
 		JoyButton output_button = _get_output_button(output);
 		JoyAxis output_axis = _get_output_axis(output);
-		ERR_CONTINUE_MSG(output_button == JOY_BUTTON_INVALID && output_axis == JOY_AXIS_INVALID,
+		ERR_CONTINUE_MSG(output_button == JoyButton::INVALID && output_axis == JoyAxis::INVALID,
 				vformat("Unrecognised output string \"%s\" in mapping:\n%s", output, p_mapping));
-		ERR_CONTINUE_MSG(output_button != JOY_BUTTON_INVALID && output_axis != JOY_AXIS_INVALID,
+		ERR_CONTINUE_MSG(output_button != JoyButton::INVALID && output_axis != JoyAxis::INVALID,
 				vformat("Output string \"%s\" matched both button and axis in mapping:\n%s", output, p_mapping));
 
 		JoyBinding binding;
-		if (output_button != JOY_BUTTON_INVALID) {
+		if (output_button != JoyButton::INVALID) {
 			binding.outputType = TYPE_BUTTON;
 			binding.output.button = output_button;
-		} else if (output_axis != JOY_AXIS_INVALID) {
+		} else if (output_axis != JoyAxis::INVALID) {
 			binding.outputType = TYPE_AXIS;
 			binding.output.axis.axis = output_axis;
 			binding.output.axis.range = output_range;

+ 11 - 11
core/input/input.h

@@ -85,11 +85,11 @@ public:
 	typedef void (*EventDispatchFunc)(const Ref<InputEvent> &p_event);
 
 private:
-	int mouse_button_mask = 0;
+	MouseButton mouse_button_mask = MouseButton::NONE;
 
-	Set<int> keys_pressed;
-	Set<int> joy_buttons_pressed;
-	Map<int, float> _joy_axis;
+	Set<Key> keys_pressed;
+	Set<JoyButton> joy_buttons_pressed;
+	Map<JoyAxis, float> _joy_axis;
 	//Map<StringName,int> custom_action_press;
 	Vector3 gravity;
 	Vector3 accelerometer;
@@ -133,9 +133,9 @@ private:
 		StringName name;
 		StringName uid;
 		bool connected = false;
-		bool last_buttons[JOY_BUTTON_MAX] = { false };
-		float last_axis[JOY_AXIS_MAX] = { 0.0f };
-		int last_hat = HatMask::HAT_MASK_CENTER;
+		bool last_buttons[(size_t)JoyButton::MAX] = { false };
+		float last_axis[(size_t)JoyAxis::MAX] = { 0.0f };
+		HatMask last_hat = HatMask::CENTER;
 		int mapping = -1;
 		int hat_current = 0;
 	};
@@ -162,7 +162,7 @@ private:
 
 	struct JoyEvent {
 		int type;
-		int index;
+		int index; // Can be either JoyAxis or JoyButton.
 		float value;
 	};
 
@@ -206,7 +206,7 @@ private:
 
 	JoyEvent _get_mapped_button_event(const JoyDeviceMapping &mapping, JoyButton p_button);
 	JoyEvent _get_mapped_axis_event(const JoyDeviceMapping &mapping, JoyAxis p_axis, float p_value);
-	void _get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat, JoyEvent r_events[HAT_MAX]);
+	void _get_mapped_hat_events(const JoyDeviceMapping &mapping, HatDir p_hat, JoyEvent r_events[(size_t)HatDir::MAX]);
 	JoyButton _get_output_button(String output);
 	JoyAxis _get_output_axis(String output);
 	void _button_event(int p_device, JoyButton p_index, bool p_pressed);
@@ -273,7 +273,7 @@ public:
 
 	Point2 get_mouse_position() const;
 	Point2 get_last_mouse_speed() const;
-	int get_mouse_button_mask() const;
+	MouseButton get_mouse_button_mask() const;
 
 	void warp_mouse_position(const Vector2 &p_to);
 	Point2i warp_mouse_motion(const Ref<InputEventMouseMotion> &p_motion, const Rect2 &p_rect);
@@ -312,7 +312,7 @@ public:
 	void parse_mapping(String p_mapping);
 	void joy_button(int p_device, JoyButton p_button, bool p_pressed);
 	void joy_axis(int p_device, JoyAxis p_axis, const JoyAxisValue &p_value);
-	void joy_hat(int p_device, int p_val);
+	void joy_hat(int p_device, HatMask p_val);
 
 	void add_joy_mapping(String p_mapping, bool p_update_existing = false);
 	void remove_joy_mapping(String p_guid);

+ 112 - 72
core/input/input_enums.h

@@ -31,90 +31,106 @@
 #ifndef INPUT_ENUMS_H
 #define INPUT_ENUMS_H
 
-enum HatDir {
-	HAT_UP = 0,
-	HAT_RIGHT = 1,
-	HAT_DOWN = 2,
-	HAT_LEFT = 3,
-	HAT_MAX = 4,
+enum class HatDir {
+	UP = 0,
+	RIGHT = 1,
+	DOWN = 2,
+	LEFT = 3,
+	MAX = 4,
 };
 
-enum HatMask {
-	HAT_MASK_CENTER = 0,
-	HAT_MASK_UP = 1,
-	HAT_MASK_RIGHT = 2,
-	HAT_MASK_DOWN = 4,
-	HAT_MASK_LEFT = 8,
+enum class HatMask {
+	CENTER = 0,
+	UP = 1,
+	RIGHT = 2,
+	DOWN = 4,
+	LEFT = 8,
 };
 
-enum JoyAxis {
-	JOY_AXIS_INVALID = -1,
-	JOY_AXIS_LEFT_X = 0,
-	JOY_AXIS_LEFT_Y = 1,
-	JOY_AXIS_RIGHT_X = 2,
-	JOY_AXIS_RIGHT_Y = 3,
-	JOY_AXIS_TRIGGER_LEFT = 4,
-	JOY_AXIS_TRIGGER_RIGHT = 5,
-	JOY_AXIS_SDL_MAX = 6,
-	JOY_AXIS_MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes.
+enum class JoyAxis {
+	INVALID = -1,
+	LEFT_X = 0,
+	LEFT_Y = 1,
+	RIGHT_X = 2,
+	RIGHT_Y = 3,
+	TRIGGER_LEFT = 4,
+	TRIGGER_RIGHT = 5,
+	SDL_MAX = 6,
+	MAX = 10, // OpenVR supports up to 5 Joysticks making a total of 10 axes.
 };
 
-enum JoyButton {
-	JOY_BUTTON_INVALID = -1,
-	JOY_BUTTON_A = 0,
-	JOY_BUTTON_B = 1,
-	JOY_BUTTON_X = 2,
-	JOY_BUTTON_Y = 3,
-	JOY_BUTTON_BACK = 4,
-	JOY_BUTTON_GUIDE = 5,
-	JOY_BUTTON_START = 6,
-	JOY_BUTTON_LEFT_STICK = 7,
-	JOY_BUTTON_RIGHT_STICK = 8,
-	JOY_BUTTON_LEFT_SHOULDER = 9,
-	JOY_BUTTON_RIGHT_SHOULDER = 10,
-	JOY_BUTTON_DPAD_UP = 11,
-	JOY_BUTTON_DPAD_DOWN = 12,
-	JOY_BUTTON_DPAD_LEFT = 13,
-	JOY_BUTTON_DPAD_RIGHT = 14,
-	JOY_BUTTON_MISC1 = 15,
-	JOY_BUTTON_PADDLE1 = 16,
-	JOY_BUTTON_PADDLE2 = 17,
-	JOY_BUTTON_PADDLE3 = 18,
-	JOY_BUTTON_PADDLE4 = 19,
-	JOY_BUTTON_TOUCHPAD = 20,
-	JOY_BUTTON_SDL_MAX = 21,
-	JOY_BUTTON_MAX = 36, // Android supports up to 36 buttons.
+enum class JoyButton {
+	INVALID = -1,
+	A = 0,
+	B = 1,
+	X = 2,
+	Y = 3,
+	BACK = 4,
+	GUIDE = 5,
+	START = 6,
+	LEFT_STICK = 7,
+	RIGHT_STICK = 8,
+	LEFT_SHOULDER = 9,
+	RIGHT_SHOULDER = 10,
+	DPAD_UP = 11,
+	DPAD_DOWN = 12,
+	DPAD_LEFT = 13,
+	DPAD_RIGHT = 14,
+	MISC1 = 15,
+	PADDLE1 = 16,
+	PADDLE2 = 17,
+	PADDLE3 = 18,
+	PADDLE4 = 19,
+	TOUCHPAD = 20,
+	SDL_MAX = 21,
+	MAX = 36, // Android supports up to 36 buttons.
 };
 
-enum MIDIMessage {
-	MIDI_MESSAGE_NONE = 0,
-	MIDI_MESSAGE_NOTE_OFF = 0x8,
-	MIDI_MESSAGE_NOTE_ON = 0x9,
-	MIDI_MESSAGE_AFTERTOUCH = 0xA,
-	MIDI_MESSAGE_CONTROL_CHANGE = 0xB,
-	MIDI_MESSAGE_PROGRAM_CHANGE = 0xC,
-	MIDI_MESSAGE_CHANNEL_PRESSURE = 0xD,
-	MIDI_MESSAGE_PITCH_BEND = 0xE,
+enum class MIDIMessage {
+	NONE = 0,
+	NOTE_OFF = 0x8,
+	NOTE_ON = 0x9,
+	AFTERTOUCH = 0xA,
+	CONTROL_CHANGE = 0xB,
+	PROGRAM_CHANGE = 0xC,
+	CHANNEL_PRESSURE = 0xD,
+	PITCH_BEND = 0xE,
 };
 
-enum MouseButton {
-	MOUSE_BUTTON_NONE = 0,
-	MOUSE_BUTTON_LEFT = 1,
-	MOUSE_BUTTON_RIGHT = 2,
-	MOUSE_BUTTON_MIDDLE = 3,
-	MOUSE_BUTTON_WHEEL_UP = 4,
-	MOUSE_BUTTON_WHEEL_DOWN = 5,
-	MOUSE_BUTTON_WHEEL_LEFT = 6,
-	MOUSE_BUTTON_WHEEL_RIGHT = 7,
-	MOUSE_BUTTON_XBUTTON1 = 8,
-	MOUSE_BUTTON_XBUTTON2 = 9,
-	MOUSE_BUTTON_MASK_LEFT = (1 << (MOUSE_BUTTON_LEFT - 1)),
-	MOUSE_BUTTON_MASK_RIGHT = (1 << (MOUSE_BUTTON_RIGHT - 1)),
-	MOUSE_BUTTON_MASK_MIDDLE = (1 << (MOUSE_BUTTON_MIDDLE - 1)),
-	MOUSE_BUTTON_MASK_XBUTTON1 = (1 << (MOUSE_BUTTON_XBUTTON1 - 1)),
-	MOUSE_BUTTON_MASK_XBUTTON2 = (1 << (MOUSE_BUTTON_XBUTTON2 - 1)),
+enum class MouseButton {
+	NONE = 0,
+	LEFT = 1,
+	RIGHT = 2,
+	MIDDLE = 3,
+	WHEEL_UP = 4,
+	WHEEL_DOWN = 5,
+	WHEEL_LEFT = 6,
+	WHEEL_RIGHT = 7,
+	MB_XBUTTON1 = 8, // "XBUTTON1" is a reserved word on Windows.
+	MB_XBUTTON2 = 9, // "XBUTTON2" is a reserved word on Windows.
+	MASK_LEFT = (1 << (LEFT - 1)),
+	MASK_RIGHT = (1 << (RIGHT - 1)),
+	MASK_MIDDLE = (1 << (MIDDLE - 1)),
+	MASK_XBUTTON1 = (1 << (MB_XBUTTON1 - 1)),
+	MASK_XBUTTON2 = (1 << (MB_XBUTTON2 - 1)),
 };
 
+inline MouseButton mouse_button_to_mask(MouseButton button) {
+	return MouseButton(1 << ((int)button - 1));
+}
+
+inline MouseButton operator&(MouseButton a, MouseButton b) {
+	return (MouseButton)((int)a & (int)b);
+}
+
+inline MouseButton operator|(MouseButton a, MouseButton b) {
+	return (MouseButton)((int)a | (int)b);
+}
+
+inline MouseButton operator^(MouseButton a, MouseButton b) {
+	return (MouseButton)((int)a ^ (int)b);
+}
+
 inline MouseButton &operator|=(MouseButton &a, MouseButton b) {
 	return (MouseButton &)((int &)a |= (int)b);
 }
@@ -123,4 +139,28 @@ inline MouseButton &operator&=(MouseButton &a, MouseButton b) {
 	return (MouseButton &)((int &)a &= (int)b);
 }
 
+inline MouseButton operator~(MouseButton a) {
+	return (MouseButton)(~(int)a);
+}
+
+inline HatMask operator|(HatMask a, HatMask b) {
+	return (HatMask)((int)a | (int)b);
+}
+
+inline HatMask operator&(HatMask a, HatMask b) {
+	return (HatMask)((int)a & (int)b);
+}
+
+inline HatMask &operator&=(HatMask &a, HatMask b) {
+	return (HatMask &)((int &)a &= (int)b);
+}
+
+inline HatMask &operator|=(HatMask &a, HatMask b) {
+	return (HatMask &)((int &)a |= (int)b);
+}
+
+inline HatMask operator~(HatMask a) {
+	return (HatMask)(~(int)a);
+}
+
 #endif // INPUT_ENUMS_H

+ 78 - 78
core/input/input_event.cpp

@@ -203,19 +203,19 @@ void InputEventWithModifiers::set_modifiers_from_event(const InputEventWithModif
 	set_meta_pressed(event->is_meta_pressed());
 }
 
-uint32_t InputEventWithModifiers::get_modifiers_mask() const {
-	uint32_t mask = 0;
+Key InputEventWithModifiers::get_modifiers_mask() const {
+	Key mask = Key::NONE;
 	if (is_ctrl_pressed()) {
-		mask |= KEY_MASK_CTRL;
+		mask |= KeyModifierMask::CTRL;
 	}
 	if (is_shift_pressed()) {
-		mask |= KEY_MASK_SHIFT;
+		mask |= KeyModifierMask::SHIFT;
 	}
 	if (is_alt_pressed()) {
-		mask |= KEY_MASK_ALT;
+		mask |= KeyModifierMask::ALT;
 	}
 	if (is_meta_pressed()) {
-		mask |= KEY_MASK_META;
+		mask |= KeyModifierMask::META;
 	}
 	return mask;
 }
@@ -224,16 +224,16 @@ String InputEventWithModifiers::as_text() const {
 	Vector<String> mod_names;
 
 	if (is_ctrl_pressed()) {
-		mod_names.push_back(find_keycode_name(KEY_CTRL));
+		mod_names.push_back(find_keycode_name(Key::CTRL));
 	}
 	if (is_shift_pressed()) {
-		mod_names.push_back(find_keycode_name(KEY_SHIFT));
+		mod_names.push_back(find_keycode_name(Key::SHIFT));
 	}
 	if (is_alt_pressed()) {
-		mod_names.push_back(find_keycode_name(KEY_ALT));
+		mod_names.push_back(find_keycode_name(Key::ALT));
 	}
 	if (is_meta_pressed()) {
-		mod_names.push_back(find_keycode_name(KEY_META));
+		mod_names.push_back(find_keycode_name(Key::META));
 	}
 
 	if (!mod_names.is_empty()) {
@@ -325,12 +325,12 @@ Key InputEventKey::get_physical_keycode() const {
 	return physical_keycode;
 }
 
-void InputEventKey::set_unicode(uint32_t p_unicode) {
+void InputEventKey::set_unicode(char32_t p_unicode) {
 	unicode = p_unicode;
 	emit_changed();
 }
 
-uint32_t InputEventKey::get_unicode() const {
+char32_t InputEventKey::get_unicode() const {
 	return unicode;
 }
 
@@ -343,18 +343,18 @@ bool InputEventKey::is_echo() const {
 	return echo;
 }
 
-uint32_t InputEventKey::get_keycode_with_modifiers() const {
+Key InputEventKey::get_keycode_with_modifiers() const {
 	return keycode | get_modifiers_mask();
 }
 
-uint32_t InputEventKey::get_physical_keycode_with_modifiers() const {
+Key InputEventKey::get_physical_keycode_with_modifiers() const {
 	return physical_keycode | get_modifiers_mask();
 }
 
 String InputEventKey::as_text() const {
 	String kc;
 
-	if (keycode == 0) {
+	if (keycode == Key::NONE) {
 		kc = keycode_get_string(physical_keycode) + " (" + RTR("Physical") + ")";
 	} else {
 		kc = keycode_get_string(keycode);
@@ -374,11 +374,11 @@ String InputEventKey::to_string() {
 
 	String kc = "";
 	String physical = "false";
-	if (keycode == 0) {
-		kc = itos(physical_keycode) + " (" + keycode_get_string(physical_keycode) + ")";
+	if (keycode == Key::NONE) {
+		kc = itos((int64_t)physical_keycode) + " (" + keycode_get_string(physical_keycode) + ")";
 		physical = "true";
 	} else {
-		kc = itos(keycode) + " (" + keycode_get_string(keycode) + ")";
+		kc = itos((int64_t)keycode) + " (" + keycode_get_string(keycode) + ")";
 	}
 
 	String mods = InputEventWithModifiers::as_text();
@@ -390,22 +390,22 @@ String InputEventKey::to_string() {
 Ref<InputEventKey> InputEventKey::create_reference(Key p_keycode) {
 	Ref<InputEventKey> ie;
 	ie.instantiate();
-	ie->set_keycode(p_keycode & KEY_CODE_MASK);
-	ie->set_unicode(p_keycode & KEY_CODE_MASK);
+	ie->set_keycode(p_keycode & KeyModifierMask::CODE_MASK);
+	ie->set_unicode(char32_t(p_keycode & KeyModifierMask::CODE_MASK));
 
-	if (p_keycode & KEY_MASK_SHIFT) {
+	if ((p_keycode & KeyModifierMask::SHIFT) != Key::NONE) {
 		ie->set_shift_pressed(true);
 	}
-	if (p_keycode & KEY_MASK_ALT) {
+	if ((p_keycode & KeyModifierMask::ALT) != Key::NONE) {
 		ie->set_alt_pressed(true);
 	}
-	if (p_keycode & KEY_MASK_CTRL) {
+	if ((p_keycode & KeyModifierMask::CTRL) != Key::NONE) {
 		ie->set_ctrl_pressed(true);
 	}
-	if (p_keycode & KEY_MASK_CMD) {
+	if ((p_keycode & KeyModifierMask::CMD) != Key::NONE) {
 		ie->set_command_pressed(true);
 	}
-	if (p_keycode & KEY_MASK_META) {
+	if ((p_keycode & KeyModifierMask::META) != Key::NONE) {
 		ie->set_meta_pressed(true);
 	}
 
@@ -419,14 +419,14 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed
 	}
 
 	bool match = false;
-	if (get_keycode() == 0) {
-		uint32_t code = get_physical_keycode_with_modifiers();
-		uint32_t event_code = key->get_physical_keycode_with_modifiers();
+	if (get_keycode() == Key::NONE) {
+		Key code = get_physical_keycode_with_modifiers();
+		Key event_code = key->get_physical_keycode_with_modifiers();
 
 		match = get_physical_keycode() == key->get_physical_keycode() && (!key->is_pressed() || (code & event_code) == code);
 	} else {
-		uint32_t code = get_keycode_with_modifiers();
-		uint32_t event_code = key->get_keycode_with_modifiers();
+		Key code = get_keycode_with_modifiers();
+		Key event_code = key->get_keycode_with_modifiers();
 
 		match = get_keycode() == key->get_keycode() && (!key->is_pressed() || (code & event_code) == code);
 	}
@@ -452,7 +452,7 @@ bool InputEventKey::is_match(const Ref<InputEvent> &p_event, bool p_exact_match)
 		return false;
 	}
 
-	if (keycode == 0) {
+	if (keycode == Key::NONE) {
 		return physical_keycode == key->physical_keycode &&
 				(!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask());
 	} else {
@@ -487,12 +487,12 @@ void InputEventKey::_bind_methods() {
 
 ///////////////////////////////////
 
-void InputEventMouse::set_button_mask(int p_mask) {
+void InputEventMouse::set_button_mask(MouseButton p_mask) {
 	button_mask = p_mask;
 	emit_changed();
 }
 
-int InputEventMouse::get_button_mask() const {
+MouseButton InputEventMouse::get_button_mask() const {
 	return button_mask;
 }
 
@@ -637,21 +637,21 @@ String InputEventMouseButton::as_text() const {
 	String full_string = mods_text == "" ? "" : mods_text + "+";
 
 	// Button
-	int idx = get_button_index();
+	MouseButton idx = get_button_index();
 	switch (idx) {
-		case MOUSE_BUTTON_LEFT:
-		case MOUSE_BUTTON_RIGHT:
-		case MOUSE_BUTTON_MIDDLE:
-		case MOUSE_BUTTON_WHEEL_UP:
-		case MOUSE_BUTTON_WHEEL_DOWN:
-		case MOUSE_BUTTON_WHEEL_LEFT:
-		case MOUSE_BUTTON_WHEEL_RIGHT:
-		case MOUSE_BUTTON_XBUTTON1:
-		case MOUSE_BUTTON_XBUTTON2:
-			full_string += RTR(_mouse_button_descriptions[idx - 1]); // button index starts from 1, array index starts from 0, so subtract 1
+		case MouseButton::LEFT:
+		case MouseButton::RIGHT:
+		case MouseButton::MIDDLE:
+		case MouseButton::WHEEL_UP:
+		case MouseButton::WHEEL_DOWN:
+		case MouseButton::WHEEL_LEFT:
+		case MouseButton::WHEEL_RIGHT:
+		case MouseButton::MB_XBUTTON1:
+		case MouseButton::MB_XBUTTON2:
+			full_string += RTR(_mouse_button_descriptions[(size_t)idx - 1]); // button index starts from 1, array index starts from 0, so subtract 1
 			break;
 		default:
-			full_string += RTR("Button") + " #" + itos(idx);
+			full_string += RTR("Button") + " #" + itos((int64_t)idx);
 			break;
 	}
 
@@ -667,20 +667,20 @@ String InputEventMouseButton::to_string() {
 	String p = is_pressed() ? "true" : "false";
 	String d = double_click ? "true" : "false";
 
-	int idx = get_button_index();
-	String button_string = itos(idx);
+	MouseButton idx = get_button_index();
+	String button_string = itos((int64_t)idx);
 
 	switch (idx) {
-		case MOUSE_BUTTON_LEFT:
-		case MOUSE_BUTTON_RIGHT:
-		case MOUSE_BUTTON_MIDDLE:
-		case MOUSE_BUTTON_WHEEL_UP:
-		case MOUSE_BUTTON_WHEEL_DOWN:
-		case MOUSE_BUTTON_WHEEL_LEFT:
-		case MOUSE_BUTTON_WHEEL_RIGHT:
-		case MOUSE_BUTTON_XBUTTON1:
-		case MOUSE_BUTTON_XBUTTON2:
-			button_string += " (" + RTR(_mouse_button_descriptions[idx - 1]) + ")"; // button index starts from 1, array index starts from 0, so subtract 1
+		case MouseButton::LEFT:
+		case MouseButton::RIGHT:
+		case MouseButton::MIDDLE:
+		case MouseButton::WHEEL_UP:
+		case MouseButton::WHEEL_DOWN:
+		case MouseButton::WHEEL_LEFT:
+		case MouseButton::WHEEL_RIGHT:
+		case MouseButton::MB_XBUTTON1:
+		case MouseButton::MB_XBUTTON2:
+			button_string += " (" + RTR(_mouse_button_descriptions[(size_t)idx - 1]) + ")"; // button index starts from 1, array index starts from 0, so subtract 1
 			break;
 		default:
 			break;
@@ -778,23 +778,23 @@ String InputEventMouseMotion::as_text() const {
 }
 
 String InputEventMouseMotion::to_string() {
-	int button_mask = get_button_mask();
-	String button_mask_string = itos(button_mask);
-	switch (get_button_mask()) {
-		case MOUSE_BUTTON_MASK_LEFT:
-			button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_LEFT - 1]) + ")";
+	MouseButton button_mask = get_button_mask();
+	String button_mask_string = itos((int64_t)button_mask);
+	switch (button_mask) {
+		case MouseButton::MASK_LEFT:
+			button_mask_string += " (" + RTR(_mouse_button_descriptions[(size_t)MouseButton::LEFT - 1]) + ")";
 			break;
-		case MOUSE_BUTTON_MASK_MIDDLE:
-			button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_MIDDLE - 1]) + ")";
+		case MouseButton::MASK_MIDDLE:
+			button_mask_string += " (" + RTR(_mouse_button_descriptions[(size_t)MouseButton::MIDDLE - 1]) + ")";
 			break;
-		case MOUSE_BUTTON_MASK_RIGHT:
-			button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_RIGHT - 1]) + ")";
+		case MouseButton::MASK_RIGHT:
+			button_mask_string += " (" + RTR(_mouse_button_descriptions[(size_t)MouseButton::RIGHT - 1]) + ")";
 			break;
-		case MOUSE_BUTTON_MASK_XBUTTON1:
-			button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON1 - 1]) + ")";
+		case MouseButton::MASK_XBUTTON1:
+			button_mask_string += " (" + RTR(_mouse_button_descriptions[(size_t)MouseButton::MB_XBUTTON1 - 1]) + ")";
 			break;
-		case MOUSE_BUTTON_MASK_XBUTTON2:
-			button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON2 - 1]) + ")";
+		case MouseButton::MASK_XBUTTON2:
+			button_mask_string += " (" + RTR(_mouse_button_descriptions[(size_t)MouseButton::MB_XBUTTON2 - 1]) + ")";
 			break;
 		default:
 			break;
@@ -869,7 +869,7 @@ void InputEventMouseMotion::_bind_methods() {
 ///////////////////////////////////
 
 void InputEventJoypadMotion::set_axis(JoyAxis p_axis) {
-	ERR_FAIL_INDEX(p_axis, JOY_AXIS_MAX);
+	ERR_FAIL_COND(p_axis < JoyAxis::LEFT_X || p_axis > JoyAxis::MAX);
 
 	axis = p_axis;
 	emit_changed();
@@ -938,7 +938,7 @@ bool InputEventJoypadMotion::is_match(const Ref<InputEvent> &p_event, bool p_exa
 			(!p_exact_match || ((axis_value < 0) == (jm->axis_value < 0)));
 }
 
-static const char *_joy_axis_descriptions[JOY_AXIS_MAX] = {
+static const char *_joy_axis_descriptions[(size_t)JoyAxis::MAX] = {
 	TTRC("Left Stick X-Axis, Joystick 0 X-Axis"),
 	TTRC("Left Stick Y-Axis, Joystick 0 Y-Axis"),
 	TTRC("Right Stick X-Axis, Joystick 1 X-Axis"),
@@ -952,7 +952,7 @@ static const char *_joy_axis_descriptions[JOY_AXIS_MAX] = {
 };
 
 String InputEventJoypadMotion::as_text() const {
-	String desc = axis < JOY_AXIS_MAX ? RTR(_joy_axis_descriptions[axis]) : TTR("Unknown Joypad Axis");
+	String desc = axis < JoyAxis::MAX ? RTR(_joy_axis_descriptions[(size_t)axis]) : TTR("Unknown Joypad Axis");
 
 	return vformat(TTR("Joypad Motion on Axis %d (%s) with Value %.2f"), axis, desc, axis_value);
 }
@@ -1032,7 +1032,7 @@ bool InputEventJoypadButton::is_match(const Ref<InputEvent> &p_event, bool p_exa
 	return button_index == button->button_index;
 }
 
-static const char *_joy_button_descriptions[JOY_BUTTON_SDL_MAX] = {
+static const char *_joy_button_descriptions[(size_t)JoyButton::SDL_MAX] = {
 	TTRC("Bottom Action, Sony Cross, Xbox A, Nintendo B"),
 	TTRC("Right Action, Sony Circle, Xbox B, Nintendo A"),
 	TTRC("Left Action, Sony Square, Xbox X, Nintendo Y"),
@@ -1057,10 +1057,10 @@ static const char *_joy_button_descriptions[JOY_BUTTON_SDL_MAX] = {
 };
 
 String InputEventJoypadButton::as_text() const {
-	String text = "Joypad Button " + itos(button_index);
+	String text = "Joypad Button " + itos((int64_t)button_index);
 
-	if (button_index >= 0 && button_index < JOY_BUTTON_SDL_MAX) {
-		text += vformat(" (%s)", _joy_button_descriptions[button_index]);
+	if (button_index > JoyButton::INVALID && button_index < JoyButton::SDL_MAX) {
+		text += vformat(" (%s)", _joy_button_descriptions[(size_t)button_index]);
 	}
 
 	if (pressure != 0) {
@@ -1506,7 +1506,7 @@ int InputEventMIDI::get_controller_value() const {
 }
 
 String InputEventMIDI::as_text() const {
-	return vformat(RTR("MIDI Input on Channel=%s Message=%s"), itos(channel), itos(message));
+	return vformat(RTR("MIDI Input on Channel=%s Message=%s"), itos(channel), itos((int64_t)message));
 }
 
 String InputEventMIDI::to_string() {

+ 12 - 12
core/input/input_event.h

@@ -151,7 +151,7 @@ public:
 
 	void set_modifiers_from_event(const InputEventWithModifiers *event);
 
-	uint32_t get_modifiers_mask() const;
+	Key get_modifiers_mask() const;
 
 	virtual String as_text() const override;
 	virtual String to_string() override;
@@ -164,8 +164,8 @@ class InputEventKey : public InputEventWithModifiers {
 
 	bool pressed = false; /// otherwise release
 
-	Key keycode = KEY_NONE; // Key enum, without modifier masks.
-	Key physical_keycode = KEY_NONE;
+	Key keycode = Key::NONE; // Key enum, without modifier masks.
+	Key physical_keycode = Key::NONE;
 	uint32_t unicode = 0; ///unicode
 
 	bool echo = false; /// true if this is an echo key
@@ -183,14 +183,14 @@ public:
 	void set_physical_keycode(Key p_keycode);
 	Key get_physical_keycode() const;
 
-	void set_unicode(uint32_t p_unicode);
-	uint32_t get_unicode() const;
+	void set_unicode(char32_t p_unicode);
+	char32_t get_unicode() const;
 
 	void set_echo(bool p_enable);
 	virtual bool is_echo() const override;
 
-	uint32_t get_keycode_with_modifiers() const;
-	uint32_t get_physical_keycode_with_modifiers() const;
+	Key get_keycode_with_modifiers() const;
+	Key get_physical_keycode_with_modifiers() const;
 
 	virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const override;
 	virtual bool is_match(const Ref<InputEvent> &p_event, bool p_exact_match = true) const override;
@@ -208,7 +208,7 @@ public:
 class InputEventMouse : public InputEventWithModifiers {
 	GDCLASS(InputEventMouse, InputEventWithModifiers);
 
-	int button_mask = 0;
+	MouseButton button_mask = MouseButton::NONE;
 
 	Vector2 pos;
 	Vector2 global_pos;
@@ -217,8 +217,8 @@ protected:
 	static void _bind_methods();
 
 public:
-	void set_button_mask(int p_mask);
-	int get_button_mask() const;
+	void set_button_mask(MouseButton p_mask);
+	MouseButton get_button_mask() const;
 
 	void set_position(const Vector2 &p_pos);
 	Vector2 get_position() const;
@@ -233,7 +233,7 @@ class InputEventMouseButton : public InputEventMouse {
 	GDCLASS(InputEventMouseButton, InputEventMouse);
 
 	float factor = 1;
-	MouseButton button_index = MOUSE_BUTTON_NONE;
+	MouseButton button_index = MouseButton::NONE;
 	bool pressed = false; //otherwise released
 	bool double_click = false; //last even less than double click time
 
@@ -501,7 +501,7 @@ class InputEventMIDI : public InputEvent {
 	GDCLASS(InputEventMIDI, InputEvent);
 
 	int channel = 0;
-	MIDIMessage message = MIDI_MESSAGE_NONE;
+	MIDIMessage message = MIDIMessage::NONE;
 	int pitch = 0;
 	int velocity = 0;
 	int instrument = 0;

+ 86 - 86
core/input/input_map.cpp

@@ -381,320 +381,320 @@ const OrderedHashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
 	}
 
 	List<Ref<InputEvent>> inputs;
-	inputs.push_back(InputEventKey::create_reference(KEY_ENTER));
-	inputs.push_back(InputEventKey::create_reference(KEY_KP_ENTER));
-	inputs.push_back(InputEventKey::create_reference(KEY_SPACE));
+	inputs.push_back(InputEventKey::create_reference(Key::ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::SPACE));
 	default_builtin_cache.insert("ui_accept", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventJoypadButton::create_reference(JOY_BUTTON_Y));
-	inputs.push_back(InputEventKey::create_reference(KEY_SPACE));
+	inputs.push_back(InputEventJoypadButton::create_reference(JoyButton::Y));
+	inputs.push_back(InputEventKey::create_reference(Key::SPACE));
 	default_builtin_cache.insert("ui_select", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_ESCAPE));
+	inputs.push_back(InputEventKey::create_reference(Key::ESCAPE));
 	default_builtin_cache.insert("ui_cancel", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_TAB));
+	inputs.push_back(InputEventKey::create_reference(Key::TAB));
 	default_builtin_cache.insert("ui_focus_next", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_TAB | KEY_MASK_SHIFT));
+	inputs.push_back(InputEventKey::create_reference(Key::TAB | KeyModifierMask::SHIFT));
 	default_builtin_cache.insert("ui_focus_prev", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_LEFT));
-	inputs.push_back(InputEventJoypadButton::create_reference(JOY_BUTTON_DPAD_LEFT));
+	inputs.push_back(InputEventKey::create_reference(Key::LEFT));
+	inputs.push_back(InputEventJoypadButton::create_reference(JoyButton::DPAD_LEFT));
 	default_builtin_cache.insert("ui_left", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_RIGHT));
-	inputs.push_back(InputEventJoypadButton::create_reference(JOY_BUTTON_DPAD_RIGHT));
+	inputs.push_back(InputEventKey::create_reference(Key::RIGHT));
+	inputs.push_back(InputEventJoypadButton::create_reference(JoyButton::DPAD_RIGHT));
 	default_builtin_cache.insert("ui_right", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_UP));
-	inputs.push_back(InputEventJoypadButton::create_reference(JOY_BUTTON_DPAD_UP));
+	inputs.push_back(InputEventKey::create_reference(Key::UP));
+	inputs.push_back(InputEventJoypadButton::create_reference(JoyButton::DPAD_UP));
 	default_builtin_cache.insert("ui_up", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DOWN));
-	inputs.push_back(InputEventJoypadButton::create_reference(JOY_BUTTON_DPAD_DOWN));
+	inputs.push_back(InputEventKey::create_reference(Key::DOWN));
+	inputs.push_back(InputEventJoypadButton::create_reference(JoyButton::DPAD_DOWN));
 	default_builtin_cache.insert("ui_down", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_PAGEUP));
+	inputs.push_back(InputEventKey::create_reference(Key::PAGEUP));
 	default_builtin_cache.insert("ui_page_up", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_PAGEDOWN));
+	inputs.push_back(InputEventKey::create_reference(Key::PAGEDOWN));
 	default_builtin_cache.insert("ui_page_down", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_HOME));
+	inputs.push_back(InputEventKey::create_reference(Key::HOME));
 	default_builtin_cache.insert("ui_home", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_END));
+	inputs.push_back(InputEventKey::create_reference(Key::END));
 	default_builtin_cache.insert("ui_end", inputs);
 
 	// ///// UI basic Shortcuts /////
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_X | KEY_MASK_CMD));
-	inputs.push_back(InputEventKey::create_reference(KEY_DELETE | KEY_MASK_SHIFT));
+	inputs.push_back(InputEventKey::create_reference(Key::X | KeyModifierMask::CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::SHIFT));
 	default_builtin_cache.insert("ui_cut", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_C | KEY_MASK_CMD));
-	inputs.push_back(InputEventKey::create_reference(KEY_INSERT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::C | KeyModifierMask::CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_copy", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_V | KEY_MASK_CMD));
-	inputs.push_back(InputEventKey::create_reference(KEY_INSERT | KEY_MASK_SHIFT));
+	inputs.push_back(InputEventKey::create_reference(Key::V | KeyModifierMask::CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::SHIFT));
 	default_builtin_cache.insert("ui_paste", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_Z | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::Z | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_undo", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_Z | KEY_MASK_CMD | KEY_MASK_SHIFT));
-	inputs.push_back(InputEventKey::create_reference(KEY_Y | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::Z | KeyModifierMask::CMD | KeyModifierMask::SHIFT));
+	inputs.push_back(InputEventKey::create_reference(Key::Y | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_redo", inputs);
 
 	// ///// UI Text Input Shortcuts /////
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_SPACE | KEY_MASK_CTRL));
+	inputs.push_back(InputEventKey::create_reference(Key::SPACE | KeyModifierMask::CTRL));
 	default_builtin_cache.insert("ui_text_completion_query", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_ENTER));
-	inputs.push_back(InputEventKey::create_reference(KEY_KP_ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER));
 	default_builtin_cache.insert("ui_text_completion_accept", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_TAB));
+	inputs.push_back(InputEventKey::create_reference(Key::TAB));
 	default_builtin_cache.insert("ui_text_completion_replace", inputs);
 
 	// Newlines
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_ENTER));
-	inputs.push_back(InputEventKey::create_reference(KEY_KP_ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER));
 	default_builtin_cache.insert("ui_text_newline", inputs);
 
 	inputs = List<Ref<InputEvent>>();
 
-	inputs.push_back(InputEventKey::create_reference(KEY_ENTER | KEY_MASK_CMD));
-	inputs.push_back(InputEventKey::create_reference(KEY_KP_ENTER | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_newline_blank", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_ENTER | KEY_MASK_SHIFT | KEY_MASK_CMD));
-	inputs.push_back(InputEventKey::create_reference(KEY_KP_ENTER | KEY_MASK_SHIFT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::ENTER | KeyModifierMask::SHIFT | KeyModifierMask::CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER | KeyModifierMask::SHIFT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_newline_above", inputs);
 
 	// Indentation
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_TAB));
+	inputs.push_back(InputEventKey::create_reference(Key::TAB));
 	default_builtin_cache.insert("ui_text_indent", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_TAB | KEY_MASK_SHIFT));
+	inputs.push_back(InputEventKey::create_reference(Key::TAB | KeyModifierMask::SHIFT));
 	default_builtin_cache.insert("ui_text_dedent", inputs);
 
 	// Text Backspace and Delete
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE));
-	inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE | KEY_MASK_SHIFT));
+	inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE));
+	inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::SHIFT));
 	default_builtin_cache.insert("ui_text_backspace", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_backspace_word", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE | KEY_MASK_ALT));
+	inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::ALT));
 	default_builtin_cache.insert("ui_text_backspace_word.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
 	default_builtin_cache.insert("ui_text_backspace_all_to_left", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_backspace_all_to_left.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DELETE));
+	inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
 	default_builtin_cache.insert("ui_text_delete", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DELETE | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_delete_word", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DELETE | KEY_MASK_ALT));
+	inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::ALT));
 	default_builtin_cache.insert("ui_text_delete_word.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
 	default_builtin_cache.insert("ui_text_delete_all_to_right", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DELETE | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_delete_all_to_right.macos", inputs);
 
 	// Text Caret Movement Left/Right
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_LEFT));
+	inputs.push_back(InputEventKey::create_reference(Key::LEFT));
 	default_builtin_cache.insert("ui_text_caret_left", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_LEFT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_word_left", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_LEFT | KEY_MASK_ALT));
+	inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::ALT));
 	default_builtin_cache.insert("ui_text_caret_word_left.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_RIGHT));
+	inputs.push_back(InputEventKey::create_reference(Key::RIGHT));
 	default_builtin_cache.insert("ui_text_caret_right", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_RIGHT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_word_right", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_RIGHT | KEY_MASK_ALT));
+	inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::ALT));
 	default_builtin_cache.insert("ui_text_caret_word_right.macos", inputs);
 
 	// Text Caret Movement Up/Down
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_UP));
+	inputs.push_back(InputEventKey::create_reference(Key::UP));
 	default_builtin_cache.insert("ui_text_caret_up", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DOWN));
+	inputs.push_back(InputEventKey::create_reference(Key::DOWN));
 	default_builtin_cache.insert("ui_text_caret_down", inputs);
 
 	// Text Caret Movement Line Start/End
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_HOME));
+	inputs.push_back(InputEventKey::create_reference(Key::HOME));
 	default_builtin_cache.insert("ui_text_caret_line_start", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_A | KEY_MASK_CTRL));
-	inputs.push_back(InputEventKey::create_reference(KEY_LEFT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::A | KeyModifierMask::CTRL));
+	inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_line_start.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_END));
+	inputs.push_back(InputEventKey::create_reference(Key::END));
 	default_builtin_cache.insert("ui_text_caret_line_end", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_E | KEY_MASK_CTRL));
-	inputs.push_back(InputEventKey::create_reference(KEY_RIGHT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::E | KeyModifierMask::CTRL));
+	inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_line_end.macos", inputs);
 
 	// Text Caret Movement Page Up/Down
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_PAGEUP));
+	inputs.push_back(InputEventKey::create_reference(Key::PAGEUP));
 	default_builtin_cache.insert("ui_text_caret_page_up", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_PAGEDOWN));
+	inputs.push_back(InputEventKey::create_reference(Key::PAGEDOWN));
 	default_builtin_cache.insert("ui_text_caret_page_down", inputs);
 
 	// Text Caret Movement Document Start/End
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_HOME | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::HOME | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_document_start", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_UP | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_document_start.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_END | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::END | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_document_end", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DOWN | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_caret_document_end.macos", inputs);
 
 	// Text Scrolling
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_UP | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_scroll_up", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_UP | KEY_MASK_CMD | KEY_MASK_ALT));
+	inputs.push_back(InputEventKey::create_reference(Key::UP | KeyModifierMask::CMD | KeyModifierMask::ALT));
 	default_builtin_cache.insert("ui_text_scroll_up.macos", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DOWN | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_scroll_down", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DOWN | KEY_MASK_CMD | KEY_MASK_ALT));
+	inputs.push_back(InputEventKey::create_reference(Key::DOWN | KeyModifierMask::CMD | KeyModifierMask::ALT));
 	default_builtin_cache.insert("ui_text_scroll_down.macos", inputs);
 
 	// Text Misc
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_A | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::A | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_select_all", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_D | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_text_select_word_under_caret", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_INSERT));
+	inputs.push_back(InputEventKey::create_reference(Key::INSERT));
 	default_builtin_cache.insert("ui_text_toggle_insert_mode", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_MENU));
+	inputs.push_back(InputEventKey::create_reference(Key::MENU));
 	default_builtin_cache.insert("ui_menu", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_ENTER));
-	inputs.push_back(InputEventKey::create_reference(KEY_KP_ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::ENTER));
+	inputs.push_back(InputEventKey::create_reference(Key::KP_ENTER));
 	default_builtin_cache.insert("ui_text_submit", inputs);
 
 	// ///// UI Graph Shortcuts /////
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_D | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::D | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_graph_duplicate", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_DELETE));
+	inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
 	default_builtin_cache.insert("ui_graph_delete", inputs);
 
 	// ///// UI File Dialog Shortcuts /////
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_BACKSPACE));
+	inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE));
 	default_builtin_cache.insert("ui_filedialog_up_one_level", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_F5));
+	inputs.push_back(InputEventKey::create_reference(Key::F5));
 	default_builtin_cache.insert("ui_filedialog_refresh", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_H));
+	inputs.push_back(InputEventKey::create_reference(Key::H));
 	default_builtin_cache.insert("ui_filedialog_show_hidden", inputs);
 
 	inputs = List<Ref<InputEvent>>();
-	inputs.push_back(InputEventKey::create_reference(KEY_QUOTELEFT | KEY_MASK_CMD));
+	inputs.push_back(InputEventKey::create_reference(Key::QUOTELEFT | KeyModifierMask::CMD));
 	default_builtin_cache.insert("ui_swap_input_direction", inputs);
 
 	return default_builtin_cache;

+ 354 - 355
core/os/keyboard.cpp

@@ -33,400 +33,399 @@
 #include "core/os/os.h"
 
 struct _KeyCodeText {
-	int code;
+	Key code;
 	const char *text;
 };
 
 static const _KeyCodeText _keycodes[] = {
 	/* clang-format off */
-		{KEY_ESCAPE                        ,"Escape"},
-		{KEY_TAB                           ,"Tab"},
-		{KEY_BACKTAB                       ,"BackTab"},
-		{KEY_BACKSPACE                     ,"BackSpace"},
-		{KEY_ENTER                         ,"Enter"},
-		{KEY_KP_ENTER                      ,"Kp Enter"},
-		{KEY_INSERT                        ,"Insert"},
-		{KEY_DELETE                        ,"Delete"},
-		{KEY_PAUSE                         ,"Pause"},
-		{KEY_PRINT                         ,"Print"},
-		{KEY_SYSREQ                        ,"SysReq"},
-		{KEY_CLEAR                         ,"Clear"},
-		{KEY_HOME                          ,"Home"},
-		{KEY_END                           ,"End"},
-		{KEY_LEFT                          ,"Left"},
-		{KEY_UP                            ,"Up"},
-		{KEY_RIGHT                         ,"Right"},
-		{KEY_DOWN                          ,"Down"},
-		{KEY_PAGEUP                        ,"PageUp"},
-		{KEY_PAGEDOWN                      ,"PageDown"},
-		{KEY_SHIFT                         ,"Shift"},
-		{KEY_CTRL                          ,"Ctrl"},
+	{Key::ESCAPE                ,"Escape"},
+	{Key::TAB                   ,"Tab"},
+	{Key::BACKTAB               ,"BackTab"},
+	{Key::BACKSPACE             ,"BackSpace"},
+	{Key::ENTER                 ,"Enter"},
+	{Key::KP_ENTER              ,"Kp Enter"},
+	{Key::INSERT                ,"Insert"},
+	{Key::KEY_DELETE            ,"Delete"},
+	{Key::PAUSE                 ,"Pause"},
+	{Key::PRINT                 ,"Print"},
+	{Key::SYSREQ                ,"SysReq"},
+	{Key::CLEAR                 ,"Clear"},
+	{Key::HOME                  ,"Home"},
+	{Key::END                   ,"End"},
+	{Key::LEFT                  ,"Left"},
+	{Key::UP                    ,"Up"},
+	{Key::RIGHT                 ,"Right"},
+	{Key::DOWN                  ,"Down"},
+	{Key::PAGEUP                ,"PageUp"},
+	{Key::PAGEDOWN              ,"PageDown"},
+	{Key::SHIFT                 ,"Shift"},
+	{Key::CTRL                  ,"Ctrl"},
 #ifdef OSX_ENABLED
-		{KEY_META                          ,"Command"},
+	{Key::META                  ,"Command"},
 #else
-		{KEY_META                          ,"Meta"},
+	{Key::META                  ,"Meta"},
 #endif
-		{KEY_ALT                           ,"Alt"},
-		{KEY_CAPSLOCK                      ,"CapsLock"},
-		{KEY_NUMLOCK                       ,"NumLock"},
-		{KEY_SCROLLLOCK                    ,"ScrollLock"},
-		{KEY_F1                            ,"F1"},
-		{KEY_F2                            ,"F2"},
-		{KEY_F3                            ,"F3"},
-		{KEY_F4                            ,"F4"},
-		{KEY_F5                            ,"F5"},
-		{KEY_F6                            ,"F6"},
-		{KEY_F7                            ,"F7"},
-		{KEY_F8                            ,"F8"},
-		{KEY_F9                            ,"F9"},
-		{KEY_F10                           ,"F10"},
-		{KEY_F11                           ,"F11"},
-		{KEY_F12                           ,"F12"},
-		{KEY_F13                           ,"F13"},
-		{KEY_F14                           ,"F14"},
-		{KEY_F15                           ,"F15"},
-		{KEY_F16                           ,"F16"},
-		{KEY_KP_MULTIPLY                   ,"Kp Multiply"},
-		{KEY_KP_DIVIDE                     ,"Kp Divide"},
-		{KEY_KP_SUBTRACT                   ,"Kp Subtract"},
-		{KEY_KP_PERIOD                     ,"Kp Period"},
-		{KEY_KP_ADD                        ,"Kp Add"},
-		{KEY_KP_0                          ,"Kp 0"},
-		{KEY_KP_1                          ,"Kp 1"},
-		{KEY_KP_2                          ,"Kp 2"},
-		{KEY_KP_3                          ,"Kp 3"},
-		{KEY_KP_4                          ,"Kp 4"},
-		{KEY_KP_5                          ,"Kp 5"},
-		{KEY_KP_6                          ,"Kp 6"},
-		{KEY_KP_7                          ,"Kp 7"},
-		{KEY_KP_8                          ,"Kp 8"},
-		{KEY_KP_9                          ,"Kp 9"},
-		{KEY_SUPER_L                       ,"Super L"},
-		{KEY_SUPER_R                       ,"Super R"},
-		{KEY_MENU                          ,"Menu"},
-		{KEY_HYPER_L                       ,"Hyper L"},
-		{KEY_HYPER_R                       ,"Hyper R"},
-		{KEY_HELP                          ,"Help"},
-		{KEY_DIRECTION_L                   ,"Direction L"},
-		{KEY_DIRECTION_R                   ,"Direction R"},
-		{KEY_BACK                          ,"Back"},
-		{KEY_FORWARD                       ,"Forward"},
-		{KEY_STOP                          ,"Stop"},
-		{KEY_REFRESH                       ,"Refresh"},
-		{KEY_VOLUMEDOWN                    ,"VolumeDown"},
-		{KEY_VOLUMEMUTE                    ,"VolumeMute"},
-		{KEY_VOLUMEUP                      ,"VolumeUp"},
-		{KEY_BASSBOOST                     ,"BassBoost"},
-		{KEY_BASSUP                        ,"BassUp"},
-		{KEY_BASSDOWN                      ,"BassDown"},
-		{KEY_TREBLEUP                      ,"TrebleUp"},
-		{KEY_TREBLEDOWN                    ,"TrebleDown"},
-		{KEY_MEDIAPLAY                     ,"MediaPlay"},
-		{KEY_MEDIASTOP                     ,"MediaStop"},
-		{KEY_MEDIAPREVIOUS                 ,"MediaPrevious"},
-		{KEY_MEDIANEXT                     ,"MediaNext"},
-		{KEY_MEDIARECORD                   ,"MediaRecord"},
-		{KEY_HOMEPAGE                      ,"HomePage"},
-		{KEY_FAVORITES                     ,"Favorites"},
-		{KEY_SEARCH                        ,"Search"},
-		{KEY_STANDBY                       ,"StandBy"},
-		{KEY_LAUNCHMAIL                    ,"LaunchMail"},
-		{KEY_LAUNCHMEDIA                   ,"LaunchMedia"},
-		{KEY_LAUNCH0                       ,"Launch0"},
-		{KEY_LAUNCH1                       ,"Launch1"},
-		{KEY_LAUNCH2                       ,"Launch2"},
-		{KEY_LAUNCH3                       ,"Launch3"},
-		{KEY_LAUNCH4                       ,"Launch4"},
-		{KEY_LAUNCH5                       ,"Launch5"},
-		{KEY_LAUNCH6                       ,"Launch6"},
-		{KEY_LAUNCH7                       ,"Launch7"},
-		{KEY_LAUNCH8                       ,"Launch8"},
-		{KEY_LAUNCH9                       ,"Launch9"},
-		{KEY_LAUNCHA                       ,"LaunchA"},
-		{KEY_LAUNCHB                       ,"LaunchB"},
-		{KEY_LAUNCHC                       ,"LaunchC"},
-		{KEY_LAUNCHD                       ,"LaunchD"},
-		{KEY_LAUNCHE                       ,"LaunchE"},
-		{KEY_LAUNCHF                       ,"LaunchF"},
-
-		{KEY_UNKNOWN                       ,"Unknown"},
-
-		{KEY_SPACE                         ,"Space"},
-		{KEY_EXCLAM                        ,"Exclam"},
-		{KEY_QUOTEDBL                      ,"QuoteDbl"},
-		{KEY_NUMBERSIGN                    ,"NumberSign"},
-		{KEY_DOLLAR                        ,"Dollar"},
-		{KEY_PERCENT                       ,"Percent"},
-		{KEY_AMPERSAND                     ,"Ampersand"},
-		{KEY_APOSTROPHE                    ,"Apostrophe"},
-		{KEY_PARENLEFT                     ,"ParenLeft"},
-		{KEY_PARENRIGHT                    ,"ParenRight"},
-		{KEY_ASTERISK                      ,"Asterisk"},
-		{KEY_PLUS                          ,"Plus"},
-		{KEY_COMMA                         ,"Comma"},
-		{KEY_MINUS                         ,"Minus"},
-		{KEY_PERIOD                        ,"Period"},
-		{KEY_SLASH                         ,"Slash"},
-		{KEY_0                             ,"0"},
-		{KEY_1                             ,"1"},
-		{KEY_2                             ,"2"},
-		{KEY_3                             ,"3"},
-		{KEY_4                             ,"4"},
-		{KEY_5                             ,"5"},
-		{KEY_6                             ,"6"},
-		{KEY_7                             ,"7"},
-		{KEY_8                             ,"8"},
-		{KEY_9                             ,"9"},
-		{KEY_COLON                         ,"Colon"},
-		{KEY_SEMICOLON                     ,"Semicolon"},
-		{KEY_LESS                          ,"Less"},
-		{KEY_EQUAL                         ,"Equal"},
-		{KEY_GREATER                       ,"Greater"},
-		{KEY_QUESTION                      ,"Question"},
-		{KEY_AT                            ,"At"},
-		{KEY_A                             ,"A"},
-		{KEY_B                             ,"B"},
-		{KEY_C                             ,"C"},
-		{KEY_D                             ,"D"},
-		{KEY_E                             ,"E"},
-		{KEY_F                             ,"F"},
-		{KEY_G                             ,"G"},
-		{KEY_H                             ,"H"},
-		{KEY_I                             ,"I"},
-		{KEY_J                             ,"J"},
-		{KEY_K                             ,"K"},
-		{KEY_L                             ,"L"},
-		{KEY_M                             ,"M"},
-		{KEY_N                             ,"N"},
-		{KEY_O                             ,"O"},
-		{KEY_P                             ,"P"},
-		{KEY_Q                             ,"Q"},
-		{KEY_R                             ,"R"},
-		{KEY_S                             ,"S"},
-		{KEY_T                             ,"T"},
-		{KEY_U                             ,"U"},
-		{KEY_V                             ,"V"},
-		{KEY_W                             ,"W"},
-		{KEY_X                             ,"X"},
-		{KEY_Y                             ,"Y"},
-		{KEY_Z                             ,"Z"},
-		{KEY_BRACKETLEFT                   ,"BracketLeft"},
-		{KEY_BACKSLASH                     ,"BackSlash"},
-		{KEY_BRACKETRIGHT                  ,"BracketRight"},
-		{KEY_ASCIICIRCUM                   ,"AsciiCircum"},
-		{KEY_UNDERSCORE                    ,"UnderScore"},
-		{KEY_QUOTELEFT                     ,"QuoteLeft"},
-		{KEY_BRACELEFT                     ,"BraceLeft"},
-		{KEY_BAR                           ,"Bar"},
-		{KEY_BRACERIGHT                    ,"BraceRight"},
-		{KEY_ASCIITILDE                    ,"AsciiTilde"},
-		{KEY_NOBREAKSPACE                  ,"NoBreakSpace"},
-		{KEY_EXCLAMDOWN                    ,"ExclamDown"},
-		{KEY_CENT                          ,"Cent"},
-		{KEY_STERLING                      ,"Sterling"},
-		{KEY_CURRENCY                      ,"Currency"},
-		{KEY_YEN                           ,"Yen"},
-		{KEY_BROKENBAR                     ,"BrokenBar"},
-		{KEY_SECTION                       ,"Section"},
-		{KEY_DIAERESIS                     ,"Diaeresis"},
-		{KEY_COPYRIGHT                     ,"Copyright"},
-		{KEY_ORDFEMININE                   ,"Ordfeminine"},
-		{KEY_GUILLEMOTLEFT                 ,"GuillemotLeft"},
-		{KEY_NOTSIGN                       ,"NotSign"},
-		{KEY_HYPHEN                        ,"Hyphen"},
-		{KEY_REGISTERED                    ,"Registered"},
-		{KEY_MACRON                        ,"Macron"},
-		{KEY_DEGREE                        ,"Degree"},
-		{KEY_PLUSMINUS                     ,"PlusMinus"},
-		{KEY_TWOSUPERIOR                   ,"TwoSuperior"},
-		{KEY_THREESUPERIOR                 ,"ThreeSuperior"},
-		{KEY_ACUTE                         ,"Acute"},
-		{KEY_MU                            ,"Mu"},
-		{KEY_PARAGRAPH                     ,"Paragraph"},
-		{KEY_PERIODCENTERED                ,"PeriodCentered"},
-		{KEY_CEDILLA                       ,"Cedilla"},
-		{KEY_ONESUPERIOR                   ,"OneSuperior"},
-		{KEY_MASCULINE                     ,"Masculine"},
-		{KEY_GUILLEMOTRIGHT                ,"GuillemotRight"},
-		{KEY_ONEQUARTER                    ,"OneQuarter"},
-		{KEY_ONEHALF                       ,"OneHalf"},
-		{KEY_THREEQUARTERS                 ,"ThreeQuarters"},
-		{KEY_QUESTIONDOWN                  ,"QuestionDown"},
-		{KEY_AGRAVE                        ,"Agrave"},
-		{KEY_AACUTE                        ,"Aacute"},
-		{KEY_ACIRCUMFLEX                   ,"AcircumFlex"},
-		{KEY_ATILDE                        ,"Atilde"},
-		{KEY_ADIAERESIS                    ,"Adiaeresis"},
-		{KEY_ARING                         ,"Aring"},
-		{KEY_AE                            ,"Ae"},
-		{KEY_CCEDILLA                      ,"Ccedilla"},
-		{KEY_EGRAVE                        ,"Egrave"},
-		{KEY_EACUTE                        ,"Eacute"},
-		{KEY_ECIRCUMFLEX                   ,"Ecircumflex"},
-		{KEY_EDIAERESIS                    ,"Ediaeresis"},
-		{KEY_IGRAVE                        ,"Igrave"},
-		{KEY_IACUTE                        ,"Iacute"},
-		{KEY_ICIRCUMFLEX                   ,"Icircumflex"},
-		{KEY_IDIAERESIS                    ,"Idiaeresis"},
-		{KEY_ETH                           ,"Eth"},
-		{KEY_NTILDE                        ,"Ntilde"},
-		{KEY_OGRAVE                        ,"Ograve"},
-		{KEY_OACUTE                        ,"Oacute"},
-		{KEY_OCIRCUMFLEX                   ,"Ocircumflex"},
-		{KEY_OTILDE                        ,"Otilde"},
-		{KEY_ODIAERESIS                    ,"Odiaeresis"},
-		{KEY_MULTIPLY                      ,"Multiply"},
-		{KEY_OOBLIQUE                      ,"Ooblique"},
-		{KEY_UGRAVE                        ,"Ugrave"},
-		{KEY_UACUTE                        ,"Uacute"},
-		{KEY_UCIRCUMFLEX                   ,"Ucircumflex"},
-		{KEY_UDIAERESIS                    ,"Udiaeresis"},
-		{KEY_YACUTE                        ,"Yacute"},
-		{KEY_THORN                         ,"Thorn"},
-		{KEY_SSHARP                        ,"Ssharp"},
-
-		{KEY_DIVISION                      ,"Division"},
-		{KEY_YDIAERESIS                    ,"Ydiaeresis"},
-		{0                                 ,nullptr}
+	{Key::ALT                   ,"Alt"},
+	{Key::CAPSLOCK              ,"CapsLock"},
+	{Key::NUMLOCK               ,"NumLock"},
+	{Key::SCROLLLOCK            ,"ScrollLock"},
+	{Key::F1                    ,"F1"},
+	{Key::F2                    ,"F2"},
+	{Key::F3                    ,"F3"},
+	{Key::F4                    ,"F4"},
+	{Key::F5                    ,"F5"},
+	{Key::F6                    ,"F6"},
+	{Key::F7                    ,"F7"},
+	{Key::F8                    ,"F8"},
+	{Key::F9                    ,"F9"},
+	{Key::F10                   ,"F10"},
+	{Key::F11                   ,"F11"},
+	{Key::F12                   ,"F12"},
+	{Key::F13                   ,"F13"},
+	{Key::F14                   ,"F14"},
+	{Key::F15                   ,"F15"},
+	{Key::F16                   ,"F16"},
+	{Key::KP_MULTIPLY           ,"Kp Multiply"},
+	{Key::KP_DIVIDE             ,"Kp Divide"},
+	{Key::KP_SUBTRACT           ,"Kp Subtract"},
+	{Key::KP_PERIOD             ,"Kp Period"},
+	{Key::KP_ADD                ,"Kp Add"},
+	{Key::KP_0                  ,"Kp 0"},
+	{Key::KP_1                  ,"Kp 1"},
+	{Key::KP_2                  ,"Kp 2"},
+	{Key::KP_3                  ,"Kp 3"},
+	{Key::KP_4                  ,"Kp 4"},
+	{Key::KP_5                  ,"Kp 5"},
+	{Key::KP_6                  ,"Kp 6"},
+	{Key::KP_7                  ,"Kp 7"},
+	{Key::KP_8                  ,"Kp 8"},
+	{Key::KP_9                  ,"Kp 9"},
+	{Key::SUPER_L               ,"Super L"},
+	{Key::SUPER_R               ,"Super R"},
+	{Key::MENU                  ,"Menu"},
+	{Key::HYPER_L               ,"Hyper L"},
+	{Key::HYPER_R               ,"Hyper R"},
+	{Key::HELP                  ,"Help"},
+	{Key::DIRECTION_L           ,"Direction L"},
+	{Key::DIRECTION_R           ,"Direction R"},
+	{Key::BACK                  ,"Back"},
+	{Key::FORWARD               ,"Forward"},
+	{Key::STOP                  ,"Stop"},
+	{Key::REFRESH               ,"Refresh"},
+	{Key::VOLUMEDOWN            ,"VolumeDown"},
+	{Key::VOLUMEMUTE            ,"VolumeMute"},
+	{Key::VOLUMEUP              ,"VolumeUp"},
+	{Key::BASSBOOST             ,"BassBoost"},
+	{Key::BASSUP                ,"BassUp"},
+	{Key::BASSDOWN              ,"BassDown"},
+	{Key::TREBLEUP              ,"TrebleUp"},
+	{Key::TREBLEDOWN            ,"TrebleDown"},
+	{Key::MEDIAPLAY             ,"MediaPlay"},
+	{Key::MEDIASTOP             ,"MediaStop"},
+	{Key::MEDIAPREVIOUS         ,"MediaPrevious"},
+	{Key::MEDIANEXT             ,"MediaNext"},
+	{Key::MEDIARECORD           ,"MediaRecord"},
+	{Key::HOMEPAGE              ,"HomePage"},
+	{Key::FAVORITES             ,"Favorites"},
+	{Key::SEARCH                ,"Search"},
+	{Key::STANDBY               ,"StandBy"},
+	{Key::LAUNCHMAIL            ,"LaunchMail"},
+	{Key::LAUNCHMEDIA           ,"LaunchMedia"},
+	{Key::LAUNCH0               ,"Launch0"},
+	{Key::LAUNCH1               ,"Launch1"},
+	{Key::LAUNCH2               ,"Launch2"},
+	{Key::LAUNCH3               ,"Launch3"},
+	{Key::LAUNCH4               ,"Launch4"},
+	{Key::LAUNCH5               ,"Launch5"},
+	{Key::LAUNCH6               ,"Launch6"},
+	{Key::LAUNCH7               ,"Launch7"},
+	{Key::LAUNCH8               ,"Launch8"},
+	{Key::LAUNCH9               ,"Launch9"},
+	{Key::LAUNCHA               ,"LaunchA"},
+	{Key::LAUNCHB               ,"LaunchB"},
+	{Key::LAUNCHC               ,"LaunchC"},
+	{Key::LAUNCHD               ,"LaunchD"},
+	{Key::LAUNCHE               ,"LaunchE"},
+	{Key::LAUNCHF               ,"LaunchF"},
+	{Key::UNKNOWN               ,"Unknown"},
+	{Key::SPACE                 ,"Space"},
+	{Key::EXCLAM                ,"Exclam"},
+	{Key::QUOTEDBL              ,"QuoteDbl"},
+	{Key::NUMBERSIGN            ,"NumberSign"},
+	{Key::DOLLAR                ,"Dollar"},
+	{Key::PERCENT               ,"Percent"},
+	{Key::AMPERSAND             ,"Ampersand"},
+	{Key::APOSTROPHE            ,"Apostrophe"},
+	{Key::PARENLEFT             ,"ParenLeft"},
+	{Key::PARENRIGHT            ,"ParenRight"},
+	{Key::ASTERISK              ,"Asterisk"},
+	{Key::PLUS                  ,"Plus"},
+	{Key::COMMA                 ,"Comma"},
+	{Key::MINUS                 ,"Minus"},
+	{Key::PERIOD                ,"Period"},
+	{Key::SLASH                 ,"Slash"},
+	{Key::KEY_0                 ,"0"},
+	{Key::KEY_1                 ,"1"},
+	{Key::KEY_2                 ,"2"},
+	{Key::KEY_3                 ,"3"},
+	{Key::KEY_4                 ,"4"},
+	{Key::KEY_5                 ,"5"},
+	{Key::KEY_6                 ,"6"},
+	{Key::KEY_7                 ,"7"},
+	{Key::KEY_8                 ,"8"},
+	{Key::KEY_9                 ,"9"},
+	{Key::COLON                 ,"Colon"},
+	{Key::SEMICOLON             ,"Semicolon"},
+	{Key::LESS                  ,"Less"},
+	{Key::EQUAL                 ,"Equal"},
+	{Key::GREATER               ,"Greater"},
+	{Key::QUESTION              ,"Question"},
+	{Key::AT                    ,"At"},
+	{Key::A                     ,"A"},
+	{Key::B                     ,"B"},
+	{Key::C                     ,"C"},
+	{Key::D                     ,"D"},
+	{Key::E                     ,"E"},
+	{Key::F                     ,"F"},
+	{Key::G                     ,"G"},
+	{Key::H                     ,"H"},
+	{Key::I                     ,"I"},
+	{Key::J                     ,"J"},
+	{Key::K                     ,"K"},
+	{Key::L                     ,"L"},
+	{Key::M                     ,"M"},
+	{Key::N                     ,"N"},
+	{Key::O                     ,"O"},
+	{Key::P                     ,"P"},
+	{Key::Q                     ,"Q"},
+	{Key::R                     ,"R"},
+	{Key::S                     ,"S"},
+	{Key::T                     ,"T"},
+	{Key::U                     ,"U"},
+	{Key::V                     ,"V"},
+	{Key::W                     ,"W"},
+	{Key::X                     ,"X"},
+	{Key::Y                     ,"Y"},
+	{Key::Z                     ,"Z"},
+	{Key::BRACKETLEFT           ,"BracketLeft"},
+	{Key::BACKSLASH             ,"BackSlash"},
+	{Key::BRACKETRIGHT          ,"BracketRight"},
+	{Key::ASCIICIRCUM           ,"AsciiCircum"},
+	{Key::UNDERSCORE            ,"UnderScore"},
+	{Key::QUOTELEFT             ,"QuoteLeft"},
+	{Key::BRACELEFT             ,"BraceLeft"},
+	{Key::BAR                   ,"Bar"},
+	{Key::BRACERIGHT            ,"BraceRight"},
+	{Key::ASCIITILDE            ,"AsciiTilde"},
+	{Key::NOBREAKSPACE          ,"NoBreakSpace"},
+	{Key::EXCLAMDOWN            ,"ExclamDown"},
+	{Key::CENT                  ,"Cent"},
+	{Key::STERLING              ,"Sterling"},
+	{Key::CURRENCY              ,"Currency"},
+	{Key::YEN                   ,"Yen"},
+	{Key::BROKENBAR             ,"BrokenBar"},
+	{Key::SECTION               ,"Section"},
+	{Key::DIAERESIS             ,"Diaeresis"},
+	{Key::COPYRIGHT             ,"Copyright"},
+	{Key::ORDFEMININE           ,"Ordfeminine"},
+	{Key::GUILLEMOTLEFT         ,"GuillemotLeft"},
+	{Key::NOTSIGN               ,"NotSign"},
+	{Key::HYPHEN                ,"Hyphen"},
+	{Key::KEY_REGISTERED        ,"Registered"},
+	{Key::MACRON                ,"Macron"},
+	{Key::DEGREE                ,"Degree"},
+	{Key::PLUSMINUS             ,"PlusMinus"},
+	{Key::TWOSUPERIOR           ,"TwoSuperior"},
+	{Key::THREESUPERIOR         ,"ThreeSuperior"},
+	{Key::ACUTE                 ,"Acute"},
+	{Key::MU                    ,"Mu"},
+	{Key::PARAGRAPH             ,"Paragraph"},
+	{Key::PERIODCENTERED        ,"PeriodCentered"},
+	{Key::CEDILLA               ,"Cedilla"},
+	{Key::ONESUPERIOR           ,"OneSuperior"},
+	{Key::MASCULINE             ,"Masculine"},
+	{Key::GUILLEMOTRIGHT        ,"GuillemotRight"},
+	{Key::ONEQUARTER            ,"OneQuarter"},
+	{Key::ONEHALF               ,"OneHalf"},
+	{Key::THREEQUARTERS         ,"ThreeQuarters"},
+	{Key::QUESTIONDOWN          ,"QuestionDown"},
+	{Key::AGRAVE                ,"Agrave"},
+	{Key::AACUTE                ,"Aacute"},
+	{Key::ACIRCUMFLEX           ,"AcircumFlex"},
+	{Key::ATILDE                ,"Atilde"},
+	{Key::ADIAERESIS            ,"Adiaeresis"},
+	{Key::ARING                 ,"Aring"},
+	{Key::AE                    ,"Ae"},
+	{Key::CCEDILLA              ,"Ccedilla"},
+	{Key::EGRAVE                ,"Egrave"},
+	{Key::EACUTE                ,"Eacute"},
+	{Key::ECIRCUMFLEX           ,"Ecircumflex"},
+	{Key::EDIAERESIS            ,"Ediaeresis"},
+	{Key::IGRAVE                ,"Igrave"},
+	{Key::IACUTE                ,"Iacute"},
+	{Key::ICIRCUMFLEX           ,"Icircumflex"},
+	{Key::IDIAERESIS            ,"Idiaeresis"},
+	{Key::ETH                   ,"Eth"},
+	{Key::NTILDE                ,"Ntilde"},
+	{Key::OGRAVE                ,"Ograve"},
+	{Key::OACUTE                ,"Oacute"},
+	{Key::OCIRCUMFLEX           ,"Ocircumflex"},
+	{Key::OTILDE                ,"Otilde"},
+	{Key::ODIAERESIS            ,"Odiaeresis"},
+	{Key::MULTIPLY              ,"Multiply"},
+	{Key::OOBLIQUE              ,"Ooblique"},
+	{Key::UGRAVE                ,"Ugrave"},
+	{Key::UACUTE                ,"Uacute"},
+	{Key::UCIRCUMFLEX           ,"Ucircumflex"},
+	{Key::UDIAERESIS            ,"Udiaeresis"},
+	{Key::YACUTE                ,"Yacute"},
+	{Key::THORN                 ,"Thorn"},
+	{Key::SSHARP                ,"Ssharp"},
+	{Key::DIVISION              ,"Division"},
+	{Key::YDIAERESIS            ,"Ydiaeresis"},
+	{Key::NONE                  ,nullptr}
 	/* clang-format on */
 };
 
-bool keycode_has_unicode(uint32_t p_keycode) {
+bool keycode_has_unicode(Key p_keycode) {
 	switch (p_keycode) {
-		case KEY_ESCAPE:
-		case KEY_TAB:
-		case KEY_BACKTAB:
-		case KEY_BACKSPACE:
-		case KEY_ENTER:
-		case KEY_KP_ENTER:
-		case KEY_INSERT:
-		case KEY_DELETE:
-		case KEY_PAUSE:
-		case KEY_PRINT:
-		case KEY_SYSREQ:
-		case KEY_CLEAR:
-		case KEY_HOME:
-		case KEY_END:
-		case KEY_LEFT:
-		case KEY_UP:
-		case KEY_RIGHT:
-		case KEY_DOWN:
-		case KEY_PAGEUP:
-		case KEY_PAGEDOWN:
-		case KEY_SHIFT:
-		case KEY_CTRL:
-		case KEY_META:
-		case KEY_ALT:
-		case KEY_CAPSLOCK:
-		case KEY_NUMLOCK:
-		case KEY_SCROLLLOCK:
-		case KEY_F1:
-		case KEY_F2:
-		case KEY_F3:
-		case KEY_F4:
-		case KEY_F5:
-		case KEY_F6:
-		case KEY_F7:
-		case KEY_F8:
-		case KEY_F9:
-		case KEY_F10:
-		case KEY_F11:
-		case KEY_F12:
-		case KEY_F13:
-		case KEY_F14:
-		case KEY_F15:
-		case KEY_F16:
-		case KEY_SUPER_L:
-		case KEY_SUPER_R:
-		case KEY_MENU:
-		case KEY_HYPER_L:
-		case KEY_HYPER_R:
-		case KEY_HELP:
-		case KEY_DIRECTION_L:
-		case KEY_DIRECTION_R:
-		case KEY_BACK:
-		case KEY_FORWARD:
-		case KEY_STOP:
-		case KEY_REFRESH:
-		case KEY_VOLUMEDOWN:
-		case KEY_VOLUMEMUTE:
-		case KEY_VOLUMEUP:
-		case KEY_BASSBOOST:
-		case KEY_BASSUP:
-		case KEY_BASSDOWN:
-		case KEY_TREBLEUP:
-		case KEY_TREBLEDOWN:
-		case KEY_MEDIAPLAY:
-		case KEY_MEDIASTOP:
-		case KEY_MEDIAPREVIOUS:
-		case KEY_MEDIANEXT:
-		case KEY_MEDIARECORD:
-		case KEY_HOMEPAGE:
-		case KEY_FAVORITES:
-		case KEY_SEARCH:
-		case KEY_STANDBY:
-		case KEY_OPENURL:
-		case KEY_LAUNCHMAIL:
-		case KEY_LAUNCHMEDIA:
-		case KEY_LAUNCH0:
-		case KEY_LAUNCH1:
-		case KEY_LAUNCH2:
-		case KEY_LAUNCH3:
-		case KEY_LAUNCH4:
-		case KEY_LAUNCH5:
-		case KEY_LAUNCH6:
-		case KEY_LAUNCH7:
-		case KEY_LAUNCH8:
-		case KEY_LAUNCH9:
-		case KEY_LAUNCHA:
-		case KEY_LAUNCHB:
-		case KEY_LAUNCHC:
-		case KEY_LAUNCHD:
-		case KEY_LAUNCHE:
-		case KEY_LAUNCHF:
+		case Key::ESCAPE:
+		case Key::TAB:
+		case Key::BACKTAB:
+		case Key::BACKSPACE:
+		case Key::ENTER:
+		case Key::KP_ENTER:
+		case Key::INSERT:
+		case Key::KEY_DELETE:
+		case Key::PAUSE:
+		case Key::PRINT:
+		case Key::SYSREQ:
+		case Key::CLEAR:
+		case Key::HOME:
+		case Key::END:
+		case Key::LEFT:
+		case Key::UP:
+		case Key::RIGHT:
+		case Key::DOWN:
+		case Key::PAGEUP:
+		case Key::PAGEDOWN:
+		case Key::SHIFT:
+		case Key::CTRL:
+		case Key::META:
+		case Key::ALT:
+		case Key::CAPSLOCK:
+		case Key::NUMLOCK:
+		case Key::SCROLLLOCK:
+		case Key::F1:
+		case Key::F2:
+		case Key::F3:
+		case Key::F4:
+		case Key::F5:
+		case Key::F6:
+		case Key::F7:
+		case Key::F8:
+		case Key::F9:
+		case Key::F10:
+		case Key::F11:
+		case Key::F12:
+		case Key::F13:
+		case Key::F14:
+		case Key::F15:
+		case Key::F16:
+		case Key::SUPER_L:
+		case Key::SUPER_R:
+		case Key::MENU:
+		case Key::HYPER_L:
+		case Key::HYPER_R:
+		case Key::HELP:
+		case Key::DIRECTION_L:
+		case Key::DIRECTION_R:
+		case Key::BACK:
+		case Key::FORWARD:
+		case Key::STOP:
+		case Key::REFRESH:
+		case Key::VOLUMEDOWN:
+		case Key::VOLUMEMUTE:
+		case Key::VOLUMEUP:
+		case Key::BASSBOOST:
+		case Key::BASSUP:
+		case Key::BASSDOWN:
+		case Key::TREBLEUP:
+		case Key::TREBLEDOWN:
+		case Key::MEDIAPLAY:
+		case Key::MEDIASTOP:
+		case Key::MEDIAPREVIOUS:
+		case Key::MEDIANEXT:
+		case Key::MEDIARECORD:
+		case Key::HOMEPAGE:
+		case Key::FAVORITES:
+		case Key::SEARCH:
+		case Key::STANDBY:
+		case Key::OPENURL:
+		case Key::LAUNCHMAIL:
+		case Key::LAUNCHMEDIA:
+		case Key::LAUNCH0:
+		case Key::LAUNCH1:
+		case Key::LAUNCH2:
+		case Key::LAUNCH3:
+		case Key::LAUNCH4:
+		case Key::LAUNCH5:
+		case Key::LAUNCH6:
+		case Key::LAUNCH7:
+		case Key::LAUNCH8:
+		case Key::LAUNCH9:
+		case Key::LAUNCHA:
+		case Key::LAUNCHB:
+		case Key::LAUNCHC:
+		case Key::LAUNCHD:
+		case Key::LAUNCHE:
+		case Key::LAUNCHF:
 			return false;
+		default: {
+		}
 	}
 
 	return true;
 }
 
-String keycode_get_string(uint32_t p_code) {
+String keycode_get_string(Key p_code) {
 	String codestr;
-	if (p_code & KEY_MASK_SHIFT) {
-		codestr += find_keycode_name(KEY_SHIFT);
+	if ((p_code & KeyModifierMask::SHIFT) != Key::NONE) {
+		codestr += find_keycode_name(Key::SHIFT);
 		codestr += "+";
 	}
-	if (p_code & KEY_MASK_ALT) {
-		codestr += find_keycode_name(KEY_ALT);
+	if ((p_code & KeyModifierMask::ALT) != Key::NONE) {
+		codestr += find_keycode_name(Key::ALT);
 		codestr += "+";
 	}
-	if (p_code & KEY_MASK_CTRL) {
-		codestr += find_keycode_name(KEY_CTRL);
+	if ((p_code & KeyModifierMask::CTRL) != Key::NONE) {
+		codestr += find_keycode_name(Key::CTRL);
 		codestr += "+";
 	}
-	if (p_code & KEY_MASK_META) {
-		codestr += find_keycode_name(KEY_META);
+	if ((p_code & KeyModifierMask::META) != Key::NONE) {
+		codestr += find_keycode_name(Key::META);
 		codestr += "+";
 	}
 
-	p_code &= KEY_CODE_MASK;
+	p_code &= KeyModifierMask::CODE_MASK;
 
 	const _KeyCodeText *kct = &_keycodes[0];
 
 	while (kct->text) {
-		if (kct->code == (int)p_code) {
+		if (kct->code == p_code) {
 			codestr += kct->text;
 			return codestr;
 		}
 		kct++;
 	}
 
-	codestr += String::chr(p_code);
+	codestr += String::chr((char32_t)p_code);
 
 	return codestr;
 }
 
-int find_keycode(const String &p_code) {
+Key find_keycode(const String &p_code) {
 	const _KeyCodeText *kct = &_keycodes[0];
 
 	while (kct->text) {
@@ -436,10 +435,10 @@ int find_keycode(const String &p_code) {
 		kct++;
 	}
 
-	return 0;
+	return Key::NONE;
 }
 
-const char *find_keycode_name(int p_keycode) {
+const char *find_keycode_name(Key p_keycode) {
 	const _KeyCodeText *kct = &_keycodes[0];
 
 	while (kct->text) {
@@ -464,7 +463,7 @@ int keycode_get_count() {
 }
 
 int keycode_get_value_by_index(int p_index) {
-	return _keycodes[p_index].code;
+	return (int)_keycodes[p_index].code;
 }
 
 const char *keycode_get_name_by_index(int p_index) {

+ 276 - 263
core/os/keyboard.h

@@ -33,148 +33,142 @@
 
 #include "core/string/ustring.h"
 
-/*
-	Special Key:
-
-	The strategy here is similar to the one used by toolkits,
-	which consists in leaving the 24 bits unicode range for printable
-	characters, and use the upper 8 bits for special keys and
-	modifiers. This way everything (char/keycode) can fit nicely in one 32 bits unsigned integer.
-*/
-enum {
-	SPKEY = (1 << 24)
-};
-
-enum Key {
-	KEY_NONE = 0,
+enum class Key {
+	NONE = 0,
+	// Special key: The strategy here is similar to the one used by toolkits,
+	// which consists in leaving the 24 bits unicode range for printable
+	// characters, and use the upper 8 bits for special keys and modifiers.
+	// This way everything (char/keycode) can fit nicely in one 32-bit
+	// integer (the enum's underlying type is `int` by default).
+	SPECIAL = (1 << 24),
 	/* CURSOR/FUNCTION/BROWSER/MULTIMEDIA/MISC KEYS */
-	KEY_ESCAPE = SPKEY | 0x01,
-	KEY_TAB = SPKEY | 0x02,
-	KEY_BACKTAB = SPKEY | 0x03,
-	KEY_BACKSPACE = SPKEY | 0x04,
-	KEY_ENTER = SPKEY | 0x05,
-	KEY_KP_ENTER = SPKEY | 0x06,
-	KEY_INSERT = SPKEY | 0x07,
-	KEY_DELETE = SPKEY | 0x08,
-	KEY_PAUSE = SPKEY | 0x09,
-	KEY_PRINT = SPKEY | 0x0A,
-	KEY_SYSREQ = SPKEY | 0x0B,
-	KEY_CLEAR = SPKEY | 0x0C,
-	KEY_HOME = SPKEY | 0x0D,
-	KEY_END = SPKEY | 0x0E,
-	KEY_LEFT = SPKEY | 0x0F,
-	KEY_UP = SPKEY | 0x10,
-	KEY_RIGHT = SPKEY | 0x11,
-	KEY_DOWN = SPKEY | 0x12,
-	KEY_PAGEUP = SPKEY | 0x13,
-	KEY_PAGEDOWN = SPKEY | 0x14,
-	KEY_SHIFT = SPKEY | 0x15,
-	KEY_CTRL = SPKEY | 0x16,
-	KEY_META = SPKEY | 0x17,
-	KEY_ALT = SPKEY | 0x18,
-	KEY_CAPSLOCK = SPKEY | 0x19,
-	KEY_NUMLOCK = SPKEY | 0x1A,
-	KEY_SCROLLLOCK = SPKEY | 0x1B,
-	KEY_F1 = SPKEY | 0x1C,
-	KEY_F2 = SPKEY | 0x1D,
-	KEY_F3 = SPKEY | 0x1E,
-	KEY_F4 = SPKEY | 0x1F,
-	KEY_F5 = SPKEY | 0x20,
-	KEY_F6 = SPKEY | 0x21,
-	KEY_F7 = SPKEY | 0x22,
-	KEY_F8 = SPKEY | 0x23,
-	KEY_F9 = SPKEY | 0x24,
-	KEY_F10 = SPKEY | 0x25,
-	KEY_F11 = SPKEY | 0x26,
-	KEY_F12 = SPKEY | 0x27,
-	KEY_F13 = SPKEY | 0x28,
-	KEY_F14 = SPKEY | 0x29,
-	KEY_F15 = SPKEY | 0x2A,
-	KEY_F16 = SPKEY | 0x2B,
-	KEY_KP_MULTIPLY = SPKEY | 0x81,
-	KEY_KP_DIVIDE = SPKEY | 0x82,
-	KEY_KP_SUBTRACT = SPKEY | 0x83,
-	KEY_KP_PERIOD = SPKEY | 0x84,
-	KEY_KP_ADD = SPKEY | 0x85,
-	KEY_KP_0 = SPKEY | 0x86,
-	KEY_KP_1 = SPKEY | 0x87,
-	KEY_KP_2 = SPKEY | 0x88,
-	KEY_KP_3 = SPKEY | 0x89,
-	KEY_KP_4 = SPKEY | 0x8A,
-	KEY_KP_5 = SPKEY | 0x8B,
-	KEY_KP_6 = SPKEY | 0x8C,
-	KEY_KP_7 = SPKEY | 0x8D,
-	KEY_KP_8 = SPKEY | 0x8E,
-	KEY_KP_9 = SPKEY | 0x8F,
-	KEY_SUPER_L = SPKEY | 0x2C,
-	KEY_SUPER_R = SPKEY | 0x2D,
-	KEY_MENU = SPKEY | 0x2E,
-	KEY_HYPER_L = SPKEY | 0x2F,
-	KEY_HYPER_R = SPKEY | 0x30,
-	KEY_HELP = SPKEY | 0x31,
-	KEY_DIRECTION_L = SPKEY | 0x32,
-	KEY_DIRECTION_R = SPKEY | 0x33,
-	KEY_BACK = SPKEY | 0x40,
-	KEY_FORWARD = SPKEY | 0x41,
-	KEY_STOP = SPKEY | 0x42,
-	KEY_REFRESH = SPKEY | 0x43,
-	KEY_VOLUMEDOWN = SPKEY | 0x44,
-	KEY_VOLUMEMUTE = SPKEY | 0x45,
-	KEY_VOLUMEUP = SPKEY | 0x46,
-	KEY_BASSBOOST = SPKEY | 0x47,
-	KEY_BASSUP = SPKEY | 0x48,
-	KEY_BASSDOWN = SPKEY | 0x49,
-	KEY_TREBLEUP = SPKEY | 0x4A,
-	KEY_TREBLEDOWN = SPKEY | 0x4B,
-	KEY_MEDIAPLAY = SPKEY | 0x4C,
-	KEY_MEDIASTOP = SPKEY | 0x4D,
-	KEY_MEDIAPREVIOUS = SPKEY | 0x4E,
-	KEY_MEDIANEXT = SPKEY | 0x4F,
-	KEY_MEDIARECORD = SPKEY | 0x50,
-	KEY_HOMEPAGE = SPKEY | 0x51,
-	KEY_FAVORITES = SPKEY | 0x52,
-	KEY_SEARCH = SPKEY | 0x53,
-	KEY_STANDBY = SPKEY | 0x54,
-	KEY_OPENURL = SPKEY | 0x55,
-	KEY_LAUNCHMAIL = SPKEY | 0x56,
-	KEY_LAUNCHMEDIA = SPKEY | 0x57,
-	KEY_LAUNCH0 = SPKEY | 0x58,
-	KEY_LAUNCH1 = SPKEY | 0x59,
-	KEY_LAUNCH2 = SPKEY | 0x5A,
-	KEY_LAUNCH3 = SPKEY | 0x5B,
-	KEY_LAUNCH4 = SPKEY | 0x5C,
-	KEY_LAUNCH5 = SPKEY | 0x5D,
-	KEY_LAUNCH6 = SPKEY | 0x5E,
-	KEY_LAUNCH7 = SPKEY | 0x5F,
-	KEY_LAUNCH8 = SPKEY | 0x60,
-	KEY_LAUNCH9 = SPKEY | 0x61,
-	KEY_LAUNCHA = SPKEY | 0x62,
-	KEY_LAUNCHB = SPKEY | 0x63,
-	KEY_LAUNCHC = SPKEY | 0x64,
-	KEY_LAUNCHD = SPKEY | 0x65,
-	KEY_LAUNCHE = SPKEY | 0x66,
-	KEY_LAUNCHF = SPKEY | 0x67,
+	ESCAPE = SPECIAL | 0x01,
+	TAB = SPECIAL | 0x02,
+	BACKTAB = SPECIAL | 0x03,
+	BACKSPACE = SPECIAL | 0x04,
+	ENTER = SPECIAL | 0x05,
+	KP_ENTER = SPECIAL | 0x06,
+	INSERT = SPECIAL | 0x07,
+	KEY_DELETE = SPECIAL | 0x08, // "DELETE" is a reserved word on Windows.
+	PAUSE = SPECIAL | 0x09,
+	PRINT = SPECIAL | 0x0A,
+	SYSREQ = SPECIAL | 0x0B,
+	CLEAR = SPECIAL | 0x0C,
+	HOME = SPECIAL | 0x0D,
+	END = SPECIAL | 0x0E,
+	LEFT = SPECIAL | 0x0F,
+	UP = SPECIAL | 0x10,
+	RIGHT = SPECIAL | 0x11,
+	DOWN = SPECIAL | 0x12,
+	PAGEUP = SPECIAL | 0x13,
+	PAGEDOWN = SPECIAL | 0x14,
+	SHIFT = SPECIAL | 0x15,
+	CTRL = SPECIAL | 0x16,
+	META = SPECIAL | 0x17,
+	ALT = SPECIAL | 0x18,
+	CAPSLOCK = SPECIAL | 0x19,
+	NUMLOCK = SPECIAL | 0x1A,
+	SCROLLLOCK = SPECIAL | 0x1B,
+	F1 = SPECIAL | 0x1C,
+	F2 = SPECIAL | 0x1D,
+	F3 = SPECIAL | 0x1E,
+	F4 = SPECIAL | 0x1F,
+	F5 = SPECIAL | 0x20,
+	F6 = SPECIAL | 0x21,
+	F7 = SPECIAL | 0x22,
+	F8 = SPECIAL | 0x23,
+	F9 = SPECIAL | 0x24,
+	F10 = SPECIAL | 0x25,
+	F11 = SPECIAL | 0x26,
+	F12 = SPECIAL | 0x27,
+	F13 = SPECIAL | 0x28,
+	F14 = SPECIAL | 0x29,
+	F15 = SPECIAL | 0x2A,
+	F16 = SPECIAL | 0x2B,
+	KP_MULTIPLY = SPECIAL | 0x81,
+	KP_DIVIDE = SPECIAL | 0x82,
+	KP_SUBTRACT = SPECIAL | 0x83,
+	KP_PERIOD = SPECIAL | 0x84,
+	KP_ADD = SPECIAL | 0x85,
+	KP_0 = SPECIAL | 0x86,
+	KP_1 = SPECIAL | 0x87,
+	KP_2 = SPECIAL | 0x88,
+	KP_3 = SPECIAL | 0x89,
+	KP_4 = SPECIAL | 0x8A,
+	KP_5 = SPECIAL | 0x8B,
+	KP_6 = SPECIAL | 0x8C,
+	KP_7 = SPECIAL | 0x8D,
+	KP_8 = SPECIAL | 0x8E,
+	KP_9 = SPECIAL | 0x8F,
+	SUPER_L = SPECIAL | 0x2C,
+	SUPER_R = SPECIAL | 0x2D,
+	MENU = SPECIAL | 0x2E,
+	HYPER_L = SPECIAL | 0x2F,
+	HYPER_R = SPECIAL | 0x30,
+	HELP = SPECIAL | 0x31,
+	DIRECTION_L = SPECIAL | 0x32,
+	DIRECTION_R = SPECIAL | 0x33,
+	BACK = SPECIAL | 0x40,
+	FORWARD = SPECIAL | 0x41,
+	STOP = SPECIAL | 0x42,
+	REFRESH = SPECIAL | 0x43,
+	VOLUMEDOWN = SPECIAL | 0x44,
+	VOLUMEMUTE = SPECIAL | 0x45,
+	VOLUMEUP = SPECIAL | 0x46,
+	BASSBOOST = SPECIAL | 0x47,
+	BASSUP = SPECIAL | 0x48,
+	BASSDOWN = SPECIAL | 0x49,
+	TREBLEUP = SPECIAL | 0x4A,
+	TREBLEDOWN = SPECIAL | 0x4B,
+	MEDIAPLAY = SPECIAL | 0x4C,
+	MEDIASTOP = SPECIAL | 0x4D,
+	MEDIAPREVIOUS = SPECIAL | 0x4E,
+	MEDIANEXT = SPECIAL | 0x4F,
+	MEDIARECORD = SPECIAL | 0x50,
+	HOMEPAGE = SPECIAL | 0x51,
+	FAVORITES = SPECIAL | 0x52,
+	SEARCH = SPECIAL | 0x53,
+	STANDBY = SPECIAL | 0x54,
+	OPENURL = SPECIAL | 0x55,
+	LAUNCHMAIL = SPECIAL | 0x56,
+	LAUNCHMEDIA = SPECIAL | 0x57,
+	LAUNCH0 = SPECIAL | 0x58,
+	LAUNCH1 = SPECIAL | 0x59,
+	LAUNCH2 = SPECIAL | 0x5A,
+	LAUNCH3 = SPECIAL | 0x5B,
+	LAUNCH4 = SPECIAL | 0x5C,
+	LAUNCH5 = SPECIAL | 0x5D,
+	LAUNCH6 = SPECIAL | 0x5E,
+	LAUNCH7 = SPECIAL | 0x5F,
+	LAUNCH8 = SPECIAL | 0x60,
+	LAUNCH9 = SPECIAL | 0x61,
+	LAUNCHA = SPECIAL | 0x62,
+	LAUNCHB = SPECIAL | 0x63,
+	LAUNCHC = SPECIAL | 0x64,
+	LAUNCHD = SPECIAL | 0x65,
+	LAUNCHE = SPECIAL | 0x66,
+	LAUNCHF = SPECIAL | 0x67,
 
-	KEY_UNKNOWN = SPKEY | 0xFFFFFF,
+	UNKNOWN = SPECIAL | 0xFFFFFF,
 
 	/* PRINTABLE LATIN 1 CODES */
 
-	KEY_SPACE = 0x0020,
-	KEY_EXCLAM = 0x0021,
-	KEY_QUOTEDBL = 0x0022,
-	KEY_NUMBERSIGN = 0x0023,
-	KEY_DOLLAR = 0x0024,
-	KEY_PERCENT = 0x0025,
-	KEY_AMPERSAND = 0x0026,
-	KEY_APOSTROPHE = 0x0027,
-	KEY_PARENLEFT = 0x0028,
-	KEY_PARENRIGHT = 0x0029,
-	KEY_ASTERISK = 0x002A,
-	KEY_PLUS = 0x002B,
-	KEY_COMMA = 0x002C,
-	KEY_MINUS = 0x002D,
-	KEY_PERIOD = 0x002E,
-	KEY_SLASH = 0x002F,
+	SPACE = 0x0020,
+	EXCLAM = 0x0021,
+	QUOTEDBL = 0x0022,
+	NUMBERSIGN = 0x0023,
+	DOLLAR = 0x0024,
+	PERCENT = 0x0025,
+	AMPERSAND = 0x0026,
+	APOSTROPHE = 0x0027,
+	PARENLEFT = 0x0028,
+	PARENRIGHT = 0x0029,
+	ASTERISK = 0x002A,
+	PLUS = 0x002B,
+	COMMA = 0x002C,
+	MINUS = 0x002D,
+	PERIOD = 0x002E,
+	SLASH = 0x002F,
 	KEY_0 = 0x0030,
 	KEY_1 = 0x0031,
 	KEY_2 = 0x0032,
@@ -185,134 +179,133 @@ enum Key {
 	KEY_7 = 0x0037,
 	KEY_8 = 0x0038,
 	KEY_9 = 0x0039,
-	KEY_COLON = 0x003A,
-	KEY_SEMICOLON = 0x003B,
-	KEY_LESS = 0x003C,
-	KEY_EQUAL = 0x003D,
-	KEY_GREATER = 0x003E,
-	KEY_QUESTION = 0x003F,
-	KEY_AT = 0x0040,
-	KEY_A = 0x0041,
-	KEY_B = 0x0042,
-	KEY_C = 0x0043,
-	KEY_D = 0x0044,
-	KEY_E = 0x0045,
-	KEY_F = 0x0046,
-	KEY_G = 0x0047,
-	KEY_H = 0x0048,
-	KEY_I = 0x0049,
-	KEY_J = 0x004A,
-	KEY_K = 0x004B,
-	KEY_L = 0x004C,
-	KEY_M = 0x004D,
-	KEY_N = 0x004E,
-	KEY_O = 0x004F,
-	KEY_P = 0x0050,
-	KEY_Q = 0x0051,
-	KEY_R = 0x0052,
-	KEY_S = 0x0053,
-	KEY_T = 0x0054,
-	KEY_U = 0x0055,
-	KEY_V = 0x0056,
-	KEY_W = 0x0057,
-	KEY_X = 0x0058,
-	KEY_Y = 0x0059,
-	KEY_Z = 0x005A,
-	KEY_BRACKETLEFT = 0x005B,
-	KEY_BACKSLASH = 0x005C,
-	KEY_BRACKETRIGHT = 0x005D,
-	KEY_ASCIICIRCUM = 0x005E,
-	KEY_UNDERSCORE = 0x005F,
-	KEY_QUOTELEFT = 0x0060,
-	KEY_BRACELEFT = 0x007B,
-	KEY_BAR = 0x007C,
-	KEY_BRACERIGHT = 0x007D,
-	KEY_ASCIITILDE = 0x007E,
-	KEY_NOBREAKSPACE = 0x00A0,
-	KEY_EXCLAMDOWN = 0x00A1,
-	KEY_CENT = 0x00A2,
-	KEY_STERLING = 0x00A3,
-	KEY_CURRENCY = 0x00A4,
-	KEY_YEN = 0x00A5,
-	KEY_BROKENBAR = 0x00A6,
-	KEY_SECTION = 0x00A7,
-	KEY_DIAERESIS = 0x00A8,
-	KEY_COPYRIGHT = 0x00A9,
-	KEY_ORDFEMININE = 0x00AA,
-	KEY_GUILLEMOTLEFT = 0x00AB,
-	KEY_NOTSIGN = 0x00AC,
-	KEY_HYPHEN = 0x00AD,
-	KEY_REGISTERED = 0x00AE,
-	KEY_MACRON = 0x00AF,
-	KEY_DEGREE = 0x00B0,
-	KEY_PLUSMINUS = 0x00B1,
-	KEY_TWOSUPERIOR = 0x00B2,
-	KEY_THREESUPERIOR = 0x00B3,
-	KEY_ACUTE = 0x00B4,
-	KEY_MU = 0x00B5,
-	KEY_PARAGRAPH = 0x00B6,
-	KEY_PERIODCENTERED = 0x00B7,
-	KEY_CEDILLA = 0x00B8,
-	KEY_ONESUPERIOR = 0x00B9,
-	KEY_MASCULINE = 0x00BA,
-	KEY_GUILLEMOTRIGHT = 0x00BB,
-	KEY_ONEQUARTER = 0x00BC,
-	KEY_ONEHALF = 0x00BD,
-	KEY_THREEQUARTERS = 0x00BE,
-	KEY_QUESTIONDOWN = 0x00BF,
-	KEY_AGRAVE = 0x00C0,
-	KEY_AACUTE = 0x00C1,
-	KEY_ACIRCUMFLEX = 0x00C2,
-	KEY_ATILDE = 0x00C3,
-	KEY_ADIAERESIS = 0x00C4,
-	KEY_ARING = 0x00C5,
-	KEY_AE = 0x00C6,
-	KEY_CCEDILLA = 0x00C7,
-	KEY_EGRAVE = 0x00C8,
-	KEY_EACUTE = 0x00C9,
-	KEY_ECIRCUMFLEX = 0x00CA,
-	KEY_EDIAERESIS = 0x00CB,
-	KEY_IGRAVE = 0x00CC,
-	KEY_IACUTE = 0x00CD,
-	KEY_ICIRCUMFLEX = 0x00CE,
-	KEY_IDIAERESIS = 0x00CF,
-	KEY_ETH = 0x00D0,
-	KEY_NTILDE = 0x00D1,
-	KEY_OGRAVE = 0x00D2,
-	KEY_OACUTE = 0x00D3,
-	KEY_OCIRCUMFLEX = 0x00D4,
-	KEY_OTILDE = 0x00D5,
-	KEY_ODIAERESIS = 0x00D6,
-	KEY_MULTIPLY = 0x00D7,
-	KEY_OOBLIQUE = 0x00D8,
-	KEY_UGRAVE = 0x00D9,
-	KEY_UACUTE = 0x00DA,
-	KEY_UCIRCUMFLEX = 0x00DB,
-	KEY_UDIAERESIS = 0x00DC,
-	KEY_YACUTE = 0x00DD,
-	KEY_THORN = 0x00DE,
-	KEY_SSHARP = 0x00DF,
+	COLON = 0x003A,
+	SEMICOLON = 0x003B,
+	LESS = 0x003C,
+	EQUAL = 0x003D,
+	GREATER = 0x003E,
+	QUESTION = 0x003F,
+	AT = 0x0040,
+	A = 0x0041,
+	B = 0x0042,
+	C = 0x0043,
+	D = 0x0044,
+	E = 0x0045,
+	F = 0x0046,
+	G = 0x0047,
+	H = 0x0048,
+	I = 0x0049,
+	J = 0x004A,
+	K = 0x004B,
+	L = 0x004C,
+	M = 0x004D,
+	N = 0x004E,
+	O = 0x004F,
+	P = 0x0050,
+	Q = 0x0051,
+	R = 0x0052,
+	S = 0x0053,
+	T = 0x0054,
+	U = 0x0055,
+	V = 0x0056,
+	W = 0x0057,
+	X = 0x0058,
+	Y = 0x0059,
+	Z = 0x005A,
+	BRACKETLEFT = 0x005B,
+	BACKSLASH = 0x005C,
+	BRACKETRIGHT = 0x005D,
+	ASCIICIRCUM = 0x005E,
+	UNDERSCORE = 0x005F,
+	QUOTELEFT = 0x0060,
+	BRACELEFT = 0x007B,
+	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,
 
-	KEY_DIVISION = 0x00F7,
-	KEY_YDIAERESIS = 0x00FF,
+	DIVISION = 0x00F7,
+	YDIAERESIS = 0x00FF,
+	END_LATIN1 = 0x0100,
 };
 
-enum KeyModifierMask {
-	KEY_CODE_MASK = ((1 << 25) - 1), ///< Apply this mask to any keycode to remove modifiers.
-	KEY_MODIFIER_MASK = (0xFF << 24), ///< Apply this mask to isolate modifiers.
-	KEY_MASK_SHIFT = (1 << 25),
-	KEY_MASK_ALT = (1 << 26),
-	KEY_MASK_META = (1 << 27),
-	KEY_MASK_CTRL = (1 << 28),
+enum class KeyModifierMask {
+	CODE_MASK = ((1 << 25) - 1), ///< Apply this mask to any keycode to remove modifiers.
+	MODIFIER_MASK = (0xFF << 24), ///< Apply this mask to isolate modifiers.
+	SHIFT = (1 << 25),
+	ALT = (1 << 26),
+	META = (1 << 27),
+	CTRL = (1 << 28),
 #ifdef APPLE_STYLE_KEYS
-	KEY_MASK_CMD = KEY_MASK_META,
+	CMD = META,
 #else
-	KEY_MASK_CMD = KEY_MASK_CTRL,
+	CMD = CTRL,
 #endif
-
-	KEY_MASK_KPAD = (1 << 29),
-	KEY_MASK_GROUP_SWITCH = (1 << 30)
-	// bit 31 can't be used because variant uses regular 32 bits int as datatype
+	KPAD = (1 << 29),
+	GROUP_SWITCH = (1 << 30)
 };
 
 // To avoid having unnecessary operators, only define the ones that are needed.
@@ -325,10 +318,26 @@ inline Key &operator-=(Key &a, int b) {
 	return (Key &)((int &)a -= b);
 }
 
+inline Key operator+(Key a, int b) {
+	return (Key)((int)a + (int)b);
+}
+
 inline Key operator+(Key a, Key b) {
+	return (Key)((int)a + (int)b);
+}
+
+inline Key operator-(Key a, Key b) {
 	return (Key)((int)a - (int)b);
 }
 
+inline Key operator&(Key a, Key b) {
+	return (Key)((int)a & (int)b);
+}
+
+inline Key operator|(Key a, Key b) {
+	return (Key)((int)a | (int)b);
+}
+
 inline Key &operator|=(Key &a, Key b) {
 	return (Key &)((int &)a |= (int)b);
 }
@@ -337,6 +346,10 @@ inline Key &operator|=(Key &a, KeyModifierMask b) {
 	return (Key &)((int &)a |= (int)b);
 }
 
+inline Key &operator&=(Key &a, KeyModifierMask b) {
+	return (Key &)((int &)a &= (int)b);
+}
+
 inline Key operator|(Key a, KeyModifierMask b) {
 	return (Key)((int)a | (int)b);
 }
@@ -361,10 +374,10 @@ inline KeyModifierMask operator|(KeyModifierMask a, KeyModifierMask b) {
 	return (KeyModifierMask)((int)a | (int)b);
 }
 
-String keycode_get_string(uint32_t p_code);
-bool keycode_has_unicode(uint32_t p_keycode);
-int find_keycode(const String &p_code);
-const char *find_keycode_name(int p_keycode);
+String keycode_get_string(Key p_code);
+bool keycode_has_unicode(Key p_keycode);
+Key find_keycode(const String &p_code);
+const char *find_keycode_name(Key p_keycode);
 int keycode_get_count();
 int keycode_get_value_by_index(int p_index);
 const char *keycode_get_name_by_index(int p_index);

+ 9 - 9
core/os/midi_driver.cpp

@@ -68,46 +68,46 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_
 	}
 
 	switch (event->get_message()) {
-		case MIDI_MESSAGE_AFTERTOUCH:
+		case MIDIMessage::AFTERTOUCH:
 			if (length >= 2 + param_position) {
 				event->set_pitch(data[param_position]);
 				event->set_pressure(data[param_position + 1]);
 			}
 			break;
 
-		case MIDI_MESSAGE_CONTROL_CHANGE:
+		case MIDIMessage::CONTROL_CHANGE:
 			if (length >= 2 + param_position) {
 				event->set_controller_number(data[param_position]);
 				event->set_controller_value(data[param_position + 1]);
 			}
 			break;
 
-		case MIDI_MESSAGE_NOTE_ON:
-		case MIDI_MESSAGE_NOTE_OFF:
+		case MIDIMessage::NOTE_ON:
+		case MIDIMessage::NOTE_OFF:
 			if (length >= 2 + param_position) {
 				event->set_pitch(data[param_position]);
 				event->set_velocity(data[param_position + 1]);
 
-				if (event->get_message() == MIDI_MESSAGE_NOTE_ON && event->get_velocity() == 0) {
+				if (event->get_message() == MIDIMessage::NOTE_ON && event->get_velocity() == 0) {
 					// https://www.midi.org/forum/228-writing-midi-software-send-note-off,-or-zero-velocity-note-on
-					event->set_message(MIDI_MESSAGE_NOTE_OFF);
+					event->set_message(MIDIMessage::NOTE_OFF);
 				}
 			}
 			break;
 
-		case MIDI_MESSAGE_PITCH_BEND:
+		case MIDIMessage::PITCH_BEND:
 			if (length >= 2 + param_position) {
 				event->set_pitch((data[param_position + 1] << 7) | data[param_position]);
 			}
 			break;
 
-		case MIDI_MESSAGE_PROGRAM_CHANGE:
+		case MIDIMessage::PROGRAM_CHANGE:
 			if (length >= 1 + param_position) {
 				event->set_instrument(data[param_position]);
 			}
 			break;
 
-		case MIDI_MESSAGE_CHANNEL_PRESSURE:
+		case MIDIMessage::CHANNEL_PRESSURE:
 			if (length >= 1 + param_position) {
 				event->set_pressure(data[param_position]);
 			}

+ 1 - 1
core/variant/binder_common.h

@@ -80,7 +80,7 @@ struct VariantCaster<const T &> {
 		}                                                                    \
 		typedef int64_t EncodeT;                                             \
 		_FORCE_INLINE_ static void encode(m_enum p_val, const void *p_ptr) { \
-			*(int64_t *)p_ptr = p_val;                                       \
+			*(int64_t *)p_ptr = (int64_t)p_val;                              \
 		}                                                                    \
 	};
 

+ 17 - 0
core/variant/variant.h

@@ -31,6 +31,7 @@
 #ifndef VARIANT_H
 #define VARIANT_H
 
+#include "core/input/input_enums.h"
 #include "core/io/ip_address.h"
 #include "core/math/aabb.h"
 #include "core/math/basis.h"
@@ -43,6 +44,7 @@
 #include "core/math/vector3.h"
 #include "core/math/vector3i.h"
 #include "core/object/object_id.h"
+#include "core/os/keyboard.h"
 #include "core/string/node_path.h"
 #include "core/string/ustring.h"
 #include "core/templates/rid.h"
@@ -430,6 +432,21 @@ public:
 
 	Variant(const IPAddress &p_address);
 
+#define VARIANT_ENUM_CLASS_CONSTRUCTOR(m_enum) \
+	Variant(const m_enum &p_value) {           \
+		type = INT;                            \
+		_data._int = (int64_t)p_value;         \
+	}
+
+	// Only enum classes that need to be bound need this to be defined.
+	VARIANT_ENUM_CLASS_CONSTRUCTOR(JoyAxis)
+	VARIANT_ENUM_CLASS_CONSTRUCTOR(JoyButton)
+	VARIANT_ENUM_CLASS_CONSTRUCTOR(Key)
+	VARIANT_ENUM_CLASS_CONSTRUCTOR(MIDIMessage)
+	VARIANT_ENUM_CLASS_CONSTRUCTOR(MouseButton)
+
+#undef VARIANT_ENUM_CLASS_CONSTRUCTOR
+
 	// If this changes the table in variant_op must be updated
 	enum Operator {
 		//comparison

+ 7 - 7
doc/classes/@GlobalScope.xml

@@ -1251,7 +1251,7 @@
 		<constant name="INLINE_ALIGN_BOTTOM" value="14" enum="InlineAlign">
 			Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equvalent to [code]INLINE_ALIGN_BOTTOM_TO | INLINE_ALIGN_TO_BOTTOM[/code].
 		</constant>
-		<constant name="SPKEY" value="16777216">
+		<constant name="KEY_SPECIAL" value="16777216" enum="Key">
 			Keycodes with this bit applied are non-printable.
 		</constant>
 		<constant name="KEY_ESCAPE" value="16777217" enum="Key">
@@ -2016,12 +2016,6 @@
 		<constant name="MOUSE_BUTTON_MIDDLE" value="3" enum="MouseButton">
 			Middle mouse button.
 		</constant>
-		<constant name="MOUSE_BUTTON_XBUTTON1" value="8" enum="MouseButton">
-			Extra mouse button 1 (only present on some mice).
-		</constant>
-		<constant name="MOUSE_BUTTON_XBUTTON2" value="9" enum="MouseButton">
-			Extra mouse button 2 (only present on some mice).
-		</constant>
 		<constant name="MOUSE_BUTTON_WHEEL_UP" value="4" enum="MouseButton">
 			Mouse wheel up.
 		</constant>
@@ -2034,6 +2028,12 @@
 		<constant name="MOUSE_BUTTON_WHEEL_RIGHT" value="7" enum="MouseButton">
 			Mouse wheel right button (only present on some mice).
 		</constant>
+		<constant name="MOUSE_BUTTON_XBUTTON1" value="8" enum="MouseButton">
+			Extra mouse button 1 (only present on some mice).
+		</constant>
+		<constant name="MOUSE_BUTTON_XBUTTON2" value="9" enum="MouseButton">
+			Extra mouse button 2 (only present on some mice).
+		</constant>
 		<constant name="MOUSE_BUTTON_MASK_LEFT" value="1" enum="MouseButton">
 			Left mouse button mask.
 		</constant>

+ 1 - 1
doc/classes/BaseButton.xml

@@ -50,7 +50,7 @@
 		<member name="button_group" type="ButtonGroup" setter="set_button_group" getter="get_button_group">
 			The [ButtonGroup] associated with the button. Not to be confused with node groups.
 		</member>
-		<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" default="1">
+		<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" enum="MouseButton" default="1">
 			Binary mask to choose which mouse buttons this button will respond to.
 			To allow both left-click and right-click, use [code]MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_RIGHT[/code].
 		</member>

+ 1 - 1
doc/classes/Input.xml

@@ -155,7 +155,7 @@
 			</description>
 		</method>
 		<method name="get_mouse_button_mask" qualifiers="const">
-			<return type="int" />
+			<return type="int" enum="MouseButton" />
 			<description>
 				Returns mouse buttons as a bitmask. If multiple mouse buttons are pressed at the same time, the bits are added together.
 			</description>

+ 2 - 2
doc/classes/InputEventKey.xml

@@ -11,14 +11,14 @@
 	</tutorials>
 	<methods>
 		<method name="get_keycode_with_modifiers" qualifiers="const">
-			<return type="int" />
+			<return type="int" enum="Key" />
 			<description>
 				Returns the keycode combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
 				To get a human-readable representation of the [InputEventKey] with modifiers, use [code]OS.get_keycode_string(event.get_keycode_with_modifiers())[/code] where [code]event[/code] is the [InputEventKey].
 			</description>
 		</method>
 		<method name="get_physical_keycode_with_modifiers" qualifiers="const">
-			<return type="int" />
+			<return type="int" enum="Key" />
 			<description>
 				Returns the physical keycode combined with modifier keys such as [kbd]Shift[/kbd] or [kbd]Alt[/kbd]. See also [InputEventWithModifiers].
 				To get a human-readable representation of the [InputEventKey] with modifiers, use [code]OS.get_keycode_string(event.get_physical_keycode_with_modifiers())[/code] where [code]event[/code] is the [InputEventKey].

+ 1 - 1
doc/classes/InputEventMouse.xml

@@ -10,7 +10,7 @@
 		<link title="InputEvent">https://docs.godotengine.org/en/latest/tutorials/inputs/inputevent.html</link>
 	</tutorials>
 	<members>
-		<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" default="0">
+		<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" enum="MouseButton" default="0">
 			The mouse button mask identifier, one of or a bitwise combination of the [enum MouseButton] button masks.
 		</member>
 		<member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position" default="Vector2(0, 0)">

+ 2 - 2
doc/classes/OS.xml

@@ -133,7 +133,7 @@
 			</description>
 		</method>
 		<method name="find_keycode_from_string" qualifiers="const">
-			<return type="int" />
+			<return type="int" enum="Key" />
 			<argument index="0" name="string" type="String" />
 			<description>
 				Returns the keycode of the given string (e.g. "Escape").
@@ -222,7 +222,7 @@
 		</method>
 		<method name="get_keycode_string" qualifiers="const">
 			<return type="String" />
-			<argument index="0" name="code" type="int" />
+			<argument index="0" name="code" type="int" enum="Key" />
 			<description>
 				Returns the given keycode as a string (e.g. Return values: [code]"Escape"[/code], [code]"Shift+Escape"[/code]).
 				See also [member InputEventKey.keycode] and [method InputEventKey.get_keycode_with_modifiers].

+ 9 - 9
doc/classes/PopupMenu.xml

@@ -15,7 +15,7 @@
 			<return type="void" />
 			<argument index="0" name="label" type="String" />
 			<argument index="1" name="id" type="int" default="-1" />
-			<argument index="2" name="accel" type="int" default="0" />
+			<argument index="2" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Adds a new checkable item with text [code]label[/code].
 				An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
@@ -38,7 +38,7 @@
 			<argument index="0" name="texture" type="Texture2D" />
 			<argument index="1" name="label" type="String" />
 			<argument index="2" name="id" type="int" default="-1" />
-			<argument index="3" name="accel" type="int" default="0" />
+			<argument index="3" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Adds a new checkable item with text [code]label[/code] and icon [code]texture[/code].
 				An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
@@ -62,7 +62,7 @@
 			<argument index="0" name="texture" type="Texture2D" />
 			<argument index="1" name="label" type="String" />
 			<argument index="2" name="id" type="int" default="-1" />
-			<argument index="3" name="accel" type="int" default="0" />
+			<argument index="3" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Adds a new item with text [code]label[/code] and icon [code]texture[/code].
 				An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
@@ -73,7 +73,7 @@
 			<argument index="0" name="texture" type="Texture2D" />
 			<argument index="1" name="label" type="String" />
 			<argument index="2" name="id" type="int" default="-1" />
-			<argument index="3" name="accel" type="int" default="0" />
+			<argument index="3" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Same as [method add_icon_check_item], but uses a radio check button.
 			</description>
@@ -103,7 +103,7 @@
 			<return type="void" />
 			<argument index="0" name="label" type="String" />
 			<argument index="1" name="id" type="int" default="-1" />
-			<argument index="2" name="accel" type="int" default="0" />
+			<argument index="2" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Adds a new item with text [code]label[/code].
 				An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
@@ -115,7 +115,7 @@
 			<argument index="1" name="max_states" type="int" />
 			<argument index="2" name="default_state" type="int" default="0" />
 			<argument index="3" name="id" type="int" default="-1" />
-			<argument index="4" name="accel" type="int" default="0" />
+			<argument index="4" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Adds a new multistate item with text [code]label[/code].
 				Contrarily to normal binary items, multistate items can have more than two states, as defined by [code]max_states[/code]. Each press or activate of the item will increase the state by one. The default value is defined by [code]default_state[/code].
@@ -126,7 +126,7 @@
 			<return type="void" />
 			<argument index="0" name="label" type="String" />
 			<argument index="1" name="id" type="int" default="-1" />
-			<argument index="2" name="accel" type="int" default="0" />
+			<argument index="2" name="accel" type="int" enum="Key" default="0" />
 			<description>
 				Adds a new radio check button with text [code]label[/code].
 				An [code]id[/code] can optionally be provided, as well as an accelerator ([code]accel[/code]). If no [code]id[/code] is provided, one will be created from the index. If no [code]accel[/code] is provided then the default [code]0[/code] will be assigned to it. See [method get_item_accelerator] for more info on accelerators.
@@ -193,7 +193,7 @@
 			</description>
 		</method>
 		<method name="get_item_accelerator" qualifiers="const">
-			<return type="int" />
+			<return type="int" enum="Key" />
 			<argument index="0" name="idx" type="int" />
 			<description>
 				Returns the accelerator of the item at index [code]idx[/code]. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
@@ -333,7 +333,7 @@
 		<method name="set_item_accelerator">
 			<return type="void" />
 			<argument index="0" name="idx" type="int" />
-			<argument index="1" name="accel" type="int" />
+			<argument index="1" name="accel" type="int" enum="Key" />
 			<description>
 				Sets the accelerator of the item at index [code]idx[/code]. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
 			</description>

+ 15 - 15
editor/action_map_editor.cpp

@@ -36,8 +36,8 @@
 
 /////////////////////////////////////////
 
-// Maps to 2*axis if value is neg, or + 1 if value is pos.
-static const char *_joy_axis_descriptions[JOY_AXIS_MAX * 2] = {
+// Maps to 2*axis if value is neg, or 2*axis+1 if value is pos.
+static const char *_joy_axis_descriptions[(size_t)JoyAxis::MAX * 2] = {
 	TTRC("Left Stick Left, Joystick 0 Left"),
 	TTRC("Left Stick Right, Joystick 0 Right"),
 	TTRC("Left Stick Up, Joystick 0 Up"),
@@ -67,11 +67,11 @@ String InputEventConfigurationDialog::get_event_text(const Ref<InputEvent> &p_ev
 	Ref<InputEventJoypadMotion> jpmotion = p_event;
 	if (jpmotion.is_valid()) {
 		String desc = TTR("Unknown Joypad Axis");
-		if (jpmotion->get_axis() < JOY_AXIS_MAX) {
-			desc = RTR(_joy_axis_descriptions[2 * jpmotion->get_axis() + (jpmotion->get_axis_value() < 0 ? 0 : 1)]);
+		if (jpmotion->get_axis() < JoyAxis::MAX) {
+			desc = RTR(_joy_axis_descriptions[2 * (size_t)jpmotion->get_axis() + (jpmotion->get_axis_value() < 0 ? 0 : 1)]);
 		}
 
-		return vformat("Joypad Axis %s %s (%s)", itos(jpmotion->get_axis()), jpmotion->get_axis_value() < 0 ? "-" : "+", desc);
+		return vformat("Joypad Axis %s %s (%s)", itos((int64_t)jpmotion->get_axis()), jpmotion->get_axis_value() < 0 ? "-" : "+", desc);
 	} else {
 		return p_event->as_text();
 	}
@@ -108,7 +108,7 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event) {
 
 		if (k.is_valid()) {
 			show_phys_key = true;
-			physical_key_checkbox->set_pressed(k->get_physical_keycode() != 0 && k->get_keycode() == 0);
+			physical_key_checkbox->set_pressed(k->get_physical_keycode() != Key::NONE && k->get_keycode() == Key::NONE);
 
 		} else if (joyb.is_valid() || joym.is_valid() || mb.is_valid()) {
 			show_device = true;
@@ -268,9 +268,9 @@ void InputEventConfigurationDialog::_listen_window_input(const Ref<InputEvent> &
 		k->set_pressed(false); // to avoid serialisation of 'pressed' property - doesn't matter for actions anyway.
 		// Maintain physical keycode option state
 		if (physical_key_checkbox->is_pressed()) {
-			k->set_keycode(KEY_NONE);
+			k->set_keycode(Key::NONE);
 		} else {
-			k->set_physical_keycode(KEY_NONE);
+			k->set_physical_keycode(Key::NONE);
 		}
 	}
 
@@ -325,7 +325,7 @@ void InputEventConfigurationDialog::_update_input_list() {
 		mouse_root->set_collapsed(collapse);
 		mouse_root->set_meta("__type", INPUT_MOUSE_BUTTON);
 
-		MouseButton mouse_buttons[9] = { MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_WHEEL_UP, MOUSE_BUTTON_WHEEL_DOWN, MOUSE_BUTTON_WHEEL_LEFT, MOUSE_BUTTON_WHEEL_RIGHT, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_XBUTTON2 };
+		MouseButton mouse_buttons[9] = { MouseButton::LEFT, MouseButton::RIGHT, MouseButton::MIDDLE, MouseButton::WHEEL_UP, MouseButton::WHEEL_DOWN, MouseButton::WHEEL_LEFT, MouseButton::WHEEL_RIGHT, MouseButton::MB_XBUTTON1, MouseButton::MB_XBUTTON2 };
 		for (int i = 0; i < 9; i++) {
 			Ref<InputEventMouseButton> mb;
 			mb.instantiate();
@@ -349,7 +349,7 @@ void InputEventConfigurationDialog::_update_input_list() {
 		joyb_root->set_collapsed(collapse);
 		joyb_root->set_meta("__type", INPUT_JOY_BUTTON);
 
-		for (int i = 0; i < JOY_BUTTON_MAX; i++) {
+		for (int i = 0; i < (int)JoyButton::MAX; i++) {
 			Ref<InputEventJoypadButton> joyb;
 			joyb.instantiate();
 			joyb->set_button_index((JoyButton)i);
@@ -372,7 +372,7 @@ void InputEventConfigurationDialog::_update_input_list() {
 		joya_root->set_collapsed(collapse);
 		joya_root->set_meta("__type", INPUT_JOY_MOTION);
 
-		for (int i = 0; i < JOY_AXIS_MAX * 2; i++) {
+		for (int i = 0; i < (int)JoyAxis::MAX * 2; i++) {
 			int axis = i / 2;
 			int direction = (i & 1) ? 1 : -1;
 			Ref<InputEventJoypadMotion> joym;
@@ -453,10 +453,10 @@ void InputEventConfigurationDialog::_physical_keycode_toggled(bool p_checked) {
 
 	if (p_checked) {
 		k->set_physical_keycode(k->get_keycode());
-		k->set_keycode(KEY_NONE);
+		k->set_keycode(Key::NONE);
 	} else {
 		k->set_keycode((Key)k->get_physical_keycode());
-		k->set_physical_keycode(KEY_NONE);
+		k->set_physical_keycode(Key::NONE);
 	}
 
 	_set_event(k);
@@ -480,9 +480,9 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
 
 			if (physical_key_checkbox->is_pressed()) {
 				k->set_physical_keycode(keycode);
-				k->set_keycode(KEY_NONE);
+				k->set_keycode(Key::NONE);
 			} else {
-				k->set_physical_keycode(KEY_NONE);
+				k->set_physical_keycode(Key::NONE);
 				k->set_keycode(keycode);
 			}
 

+ 9 - 9
editor/animation_bezier_editor.cpp

@@ -618,7 +618,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 		const float v_zoom_orig = v_zoom;
 		if (mb->is_command_pressed()) {
 			timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
@@ -631,7 +631,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		update();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 		const float v_zoom_orig = v_zoom;
 		if (mb->is_command_pressed()) {
 			timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
@@ -644,7 +644,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		update();
 	}
 
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::MIDDLE) {
 		if (mb->is_pressed()) {
 			int x = mb->get_position().x - timeline->get_name_limit();
 			panning_timeline_from = x / timeline->get_zoom_scale();
@@ -655,7 +655,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 		menu_insert_key = mb->get_position();
 		if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) {
 			Vector2 popup_pos = get_global_transform().xform(mb->get_position());
@@ -675,7 +675,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		if (close_icon_rect.has_point(mb->get_position())) {
 			emit_signal(SNAME("close_request"));
 			return;
@@ -792,7 +792,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		if (box_selecting) {
 			//do actual select
 			if (!box_selecting_add) {
@@ -822,7 +822,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		update();
 	}
 
-	if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		undo_redo->create_action(TTR("Move Bezier Points"));
 		undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, moving_handle_left);
 		undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, moving_handle_right);
@@ -834,7 +834,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		update();
 	}
 
-	if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		if (moving_selection) {
 			//combit it
 
@@ -929,7 +929,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseMotion> mm = p_event;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) {
 		v_scroll += mm->get_relative().y * v_zoom;
 		if (v_scroll > 100000) {
 			v_scroll = 100000;

+ 38 - 38
editor/animation_track_editor.cpp

@@ -1722,48 +1722,48 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
 
 	const Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 		get_zoom()->set_value(get_zoom()->get_value() * 1.05);
 		accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 		get_zoom()->set_value(get_zoom()->get_value() / 1.05);
 		accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 		if (track_edit) {
 			track_edit->get_editor()->goto_prev_step(true);
 		}
 		accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 		if (track_edit) {
 			track_edit->get_editor()->goto_next_step(true);
 		}
 		accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && hsize_rect.has_point(mb->get_position())) {
 		dragging_hsize = true;
 		dragging_hsize_from = mb->get_position().x;
 		dragging_hsize_at = name_limit;
 	}
 
-	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && dragging_hsize) {
+	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && dragging_hsize) {
 		dragging_hsize = false;
 	}
 	if (mb.is_valid() && mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) {
-		if (!panning_timeline && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (!panning_timeline && mb->get_button_index() == MouseButton::LEFT) {
 			int x = mb->get_position().x - get_name_limit();
 
 			float ofs = x / get_zoom_scale() + get_value();
-			emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(KEY_ALT));
+			emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(Key::ALT));
 			dragging_timeline = true;
 		}
-		if (!dragging_timeline && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) {
+		if (!dragging_timeline && mb->get_button_index() == MouseButton::MIDDLE) {
 			int x = mb->get_position().x - get_name_limit();
 			panning_timeline_from = x / get_zoom_scale();
 			panning_timeline = true;
@@ -1771,11 +1771,11 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (dragging_timeline && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
+	if (dragging_timeline && mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed()) {
 		dragging_timeline = false;
 	}
 
-	if (panning_timeline && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_MIDDLE && !mb->is_pressed()) {
+	if (panning_timeline && mb.is_valid() && mb->get_button_index() == MouseButton::MIDDLE && !mb->is_pressed()) {
 		panning_timeline = false;
 	}
 
@@ -1799,7 +1799,7 @@ void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
 		if (dragging_timeline) {
 			int x = mm->get_position().x - get_name_limit();
 			float ofs = x / get_zoom_scale() + get_value();
-			emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(KEY_ALT));
+			emit_signal(SNAME("timeline_changed"), ofs, false, Input::get_singleton()->is_key_pressed(Key::ALT));
 		}
 		if (panning_timeline) {
 			int x = mm->get_position().x - get_name_limit();
@@ -2655,7 +2655,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		Point2 pos = mb->get_position();
 
 		if (check_rect.has_point(pos)) {
@@ -2801,7 +2801,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
 		Point2 pos = mb->get_position();
 		if (pos.x >= timeline->get_name_limit() && pos.x <= get_size().width - timeline->get_buttons_width()) {
 			// Can do something with menu too! show insert key.
@@ -2831,7 +2831,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && clicking_on_name) {
+	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && clicking_on_name) {
 		if (!path) {
 			path_popup = memnew(Popup);
 			path_popup->set_wrap_controls(true);
@@ -2853,7 +2853,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	if (mb.is_valid() && moving_selection_attempt) {
-		if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (!mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 			moving_selection_attempt = false;
 			if (moving_selection) {
 				emit_signal(SNAME("move_selection_commit"));
@@ -2864,7 +2864,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 			select_single_attempt = -1;
 		}
 
-		if (moving_selection && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (moving_selection && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
 			moving_selection_attempt = false;
 			moving_selection = false;
 			emit_signal(SNAME("move_selection_cancel"));
@@ -2872,7 +2872,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseMotion> mm = p_event;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && moving_selection_attempt) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE && moving_selection_attempt) {
 		if (!moving_selection) {
 			moving_selection = true;
 			emit_signal(SNAME("move_selection_begin"));
@@ -4166,7 +4166,7 @@ bool AnimationTrackEditor::is_selection_active() const {
 }
 
 bool AnimationTrackEditor::is_snap_enabled() const {
-	return snap->is_pressed() ^ Input::get_singleton()->is_key_pressed(KEY_CTRL);
+	return snap->is_pressed() ^ Input::get_singleton()->is_key_pressed(Key::CTRL);
 }
 
 void AnimationTrackEditor::_update_tracks() {
@@ -5147,27 +5147,27 @@ void AnimationTrackEditor::_box_selection_draw() {
 void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 		timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
 		scroll->accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 		timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
 		scroll->accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 		goto_prev_step(true);
 		scroll->accept_event();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+	if (mb.is_valid() && mb->is_pressed() && mb->is_alt_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 		goto_next_step(true);
 		scroll->accept_event();
 	}
 
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_pressed()) {
 			box_selecting = true;
 			box_selecting_from = scroll->get_global_transform().xform(mb->get_position());
@@ -5195,12 +5195,12 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
 
 	Ref<InputEventMouseMotion> mm = p_event;
 
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) {
 		timeline->set_value(timeline->get_value() - mm->get_relative().x / timeline->get_zoom_scale());
 	}
 
 	if (mm.is_valid() && box_selecting) {
-		if (!(mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT)) {
+		if ((mm->get_button_mask() & MouseButton::MASK_LEFT) == MouseButton::NONE) {
 			// No longer.
 			box_selection->hide();
 			box_selecting = false;
@@ -5349,7 +5349,7 @@ void AnimationTrackEditor::goto_prev_step(bool p_from_mouse_event) {
 	if (step == 0) {
 		step = 1;
 	}
-	if (p_from_mouse_event && Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (p_from_mouse_event && Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		// Use more precise snapping when holding Shift.
 		// This is used when scrobbling the timeline using Alt + Mouse wheel.
 		step *= 0.25;
@@ -5372,7 +5372,7 @@ void AnimationTrackEditor::goto_next_step(bool p_from_mouse_event) {
 	if (step == 0) {
 		step = 1;
 	}
-	if (p_from_mouse_event && Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (p_from_mouse_event && Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		// Use more precise snapping when holding Shift.
 		// This is used when scrobbling the timeline using Alt + Mouse wheel.
 		// Do not use precise snapping when using the menu action or keyboard shortcut,
@@ -5808,7 +5808,7 @@ float AnimationTrackEditor::snap_time(float p_value, bool p_relative) {
 			snap_increment = step->get_value();
 		}
 
-		if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+		if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 			// Use more precise snapping when holding Shift.
 			snap_increment *= 0.25;
 		}
@@ -5922,10 +5922,10 @@ void AnimationTrackEditor::_pick_track_filter_input(const Ref<InputEvent> &p_ie)
 
 	if (k.is_valid()) {
 		switch (k->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				pick_track->get_scene_tree()->get_scene_tree()->gui_input(k);
 				pick_track->get_filter_line_edit()->accept_event();
 			} break;
@@ -6086,14 +6086,14 @@ AnimationTrackEditor::AnimationTrackEditor() {
 	edit->get_popup()->add_item(TTR("Scale Selection"), EDIT_SCALE_SELECTION);
 	edit->get_popup()->add_item(TTR("Scale From Cursor"), EDIT_SCALE_FROM_CURSOR);
 	edit->get_popup()->add_separator();
-	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_SELECTION);
-	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection_transposed", TTR("Duplicate Transposed"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D), EDIT_DUPLICATE_TRANSPOSED);
+	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection", TTR("Duplicate Selection"), KeyModifierMask::CMD | Key::D), EDIT_DUPLICATE_SELECTION);
+	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/duplicate_selection_transposed", TTR("Duplicate Transposed"), KeyModifierMask::SHIFT | KeyModifierMask::CMD | Key::D), EDIT_DUPLICATE_TRANSPOSED);
 	edit->get_popup()->add_separator();
-	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/delete_selection", TTR("Delete Selection"), KEY_DELETE), EDIT_DELETE_SELECTION);
+	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/delete_selection", TTR("Delete Selection"), Key::KEY_DELETE), EDIT_DELETE_SELECTION);
 
 	edit->get_popup()->add_separator();
-	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Go to Next Step"), KEY_MASK_CMD | KEY_RIGHT), EDIT_GOTO_NEXT_STEP);
-	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_prev_step", TTR("Go to Previous Step"), KEY_MASK_CMD | KEY_LEFT), EDIT_GOTO_PREV_STEP);
+	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTR("Go to Next Step"), KeyModifierMask::CMD | Key::RIGHT), EDIT_GOTO_NEXT_STEP);
+	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_prev_step", TTR("Go to Previous Step"), KeyModifierMask::CMD | Key::LEFT), EDIT_GOTO_PREV_STEP);
 	edit->get_popup()->add_separator();
 	edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/apply_reset", TTR("Apply Reset")), EDIT_APPLY_RESET);
 	edit->get_popup()->add_separator();

+ 2 - 2
editor/animation_track_editor_plugins.cpp

@@ -1098,7 +1098,7 @@ void AnimationTrackEditTypeAudio::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
 		len_resizing = true;
 		len_resizing_start = mb->is_shift_pressed();
 		len_resizing_from_px = mb->get_position().x;
@@ -1108,7 +1108,7 @@ void AnimationTrackEditTypeAudio::gui_input(const Ref<InputEvent> &p_event) {
 		return;
 	}
 
-	if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		float ofs_local = -len_resizing_rel / get_timeline()->get_zoom_scale();
 		if (len_resizing_start) {
 			float prev_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), len_resizing_index);

+ 9 - 9
editor/code_editor.cpp

@@ -127,7 +127,7 @@ void FindReplaceBar::unhandled_input(const Ref<InputEvent> &p_event) {
 		bool accepted = true;
 
 		switch (k->get_keycode()) {
-			case KEY_ESCAPE: {
+			case Key::ESCAPE: {
 				_hide_bar();
 			} break;
 			default: {
@@ -542,7 +542,7 @@ void FindReplaceBar::_search_text_changed(const String &p_text) {
 }
 
 void FindReplaceBar::_search_text_submitted(const String &p_text) {
-	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		search_prev();
 	} else {
 		search_next();
@@ -553,7 +553,7 @@ void FindReplaceBar::_replace_text_submitted(const String &p_text) {
 	if (selection_only->is_pressed() && text_editor->has_selection()) {
 		_replace_all();
 		_hide_bar();
-	} else if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	} else if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		_replace();
 		search_prev();
 	} else {
@@ -766,9 +766,9 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
 
 	if (mb.is_valid()) {
 		if (mb->is_pressed() && mb->is_command_pressed()) {
-			if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+			if (mb->get_button_index() == MouseButton::WHEEL_UP) {
 				_zoom_in();
-			} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+			} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 				_zoom_out();
 			}
 		}
@@ -1654,7 +1654,7 @@ void CodeTextEditor::_toggle_scripts_pressed() {
 
 void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		goto_error();
 	}
 }
@@ -1788,9 +1788,9 @@ void CodeTextEditor::update_toggle_scripts_button() {
 
 CodeTextEditor::CodeTextEditor() {
 	code_complete_func = nullptr;
-	ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL);
-	ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS);
-	ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KEY_MASK_CMD | KEY_0);
+	ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KeyModifierMask::CMD | Key::EQUAL);
+	ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KeyModifierMask::CMD | Key::MINUS);
+	ED_SHORTCUT("script_editor/reset_zoom", TTR("Reset Zoom"), KeyModifierMask::CMD | Key::KEY_0);
 
 	text_editor = memnew(CodeEdit);
 	add_child(text_editor);

+ 4 - 4
editor/create_dialog.cpp

@@ -352,10 +352,10 @@ void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
 	Ref<InputEventKey> k = p_ie;
 	if (k.is_valid()) {
 		switch (k->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				search_options->gui_input(k);
 				search_box->accept_event();
 			} break;

+ 1 - 1
editor/debugger/editor_performance_profiler.cpp

@@ -249,7 +249,7 @@ TreeItem *EditorPerformanceProfiler::_create_monitor_item(const StringName &p_mo
 
 void EditorPerformanceProfiler::_marker_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		Vector<StringName> active;
 		for (OrderedHashMap<StringName, Monitor>::Element i = monitors.front(); i; i = i.next()) {
 			if (i.value().item->is_checked(0)) {

+ 2 - 2
editor/debugger/editor_profiler.cpp

@@ -438,7 +438,7 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
 	Ref<InputEventMouseMotion> mm = p_ev;
 
 	if (
-			(mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) ||
+			(mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) ||
 			(mm.is_valid())) {
 		int x = me->get_position().x - 1;
 		x = x * frame_metrics.size() / graph->get_size().width;
@@ -453,7 +453,7 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
 			x = frame_metrics.size() - 1;
 		}
 
-		if (mb.is_valid() || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+		if (mb.is_valid() || (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 			updating_frame = true;
 
 			if (x < total_metrics)

+ 2 - 2
editor/debugger/editor_visual_profiler.cpp

@@ -517,7 +517,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
 	Ref<InputEventMouseMotion> mm = p_ev;
 
 	if (
-			(mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) ||
+			(mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) ||
 			(mm.is_valid())) {
 		int half_w = graph->get_size().width / 2;
 		int x = me->get_position().x;
@@ -549,7 +549,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
 			hover_metric = -1;
 		}
 
-		if (mb.is_valid() || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+		if (mb.is_valid() || (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 			//cursor_metric=x;
 			updating_frame = true;
 

+ 6 - 6
editor/editor_audio_buses.cpp

@@ -303,7 +303,7 @@ void EditorAudioBus::_volume_changed(float p_normalized) {
 
 	const float p_db = this->_normalized_volume_to_scaled_db(p_normalized);
 
-	if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+	if (Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 		// Snap the value when holding Ctrl for easier editing.
 		// To do so, it needs to be converted back to normalized volume (as the slider uses that unit).
 		slider->set_value(_scaled_db_to_normalized_volume(Math::round(p_db)));
@@ -363,7 +363,7 @@ float EditorAudioBus::_scaled_db_to_normalized_volume(float db) {
 
 void EditorAudioBus::_show_value(float slider_value) {
 	float db;
-	if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+	if (Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 		// Display the correct (snapped) value when holding Ctrl
 		db = Math::round(_normalized_volume_to_scaled_db(slider_value));
 	} else {
@@ -534,7 +534,7 @@ void EditorAudioBus::gui_input(const Ref<InputEvent> &p_event) {
 	ERR_FAIL_COND(p_event.is_null());
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 		Vector2 pos = mb->get_position();
 		bus_popup->set_position(get_global_position() + pos);
 		bus_popup->popup();
@@ -543,7 +543,7 @@ void EditorAudioBus::gui_input(const Ref<InputEvent> &p_event) {
 
 void EditorAudioBus::_effects_gui_input(Ref<InputEvent> p_event) {
 	Ref<InputEventKey> k = p_event;
-	if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_DELETE) {
+	if (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == Key::KEY_DELETE) {
 		TreeItem *current_effect = effects->get_selected();
 		if (current_effect && current_effect->get_metadata(0).get_type() == Variant::INT) {
 			_delete_effect_pressed(0);
@@ -925,8 +925,8 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
 	hbc->add_child(bus_options);
 
 	bus_popup = bus_options->get_popup();
-	bus_popup->add_shortcut(ED_SHORTCUT("audio_bus_editor/duplicate_selected_bus", TTR("Duplicate Bus"), KEY_MASK_CMD | KEY_D));
-	bus_popup->add_shortcut(ED_SHORTCUT("audio_bus_editor/delete_selected_bus", TTR("Delete Bus"), KEY_DELETE));
+	bus_popup->add_shortcut(ED_SHORTCUT("audio_bus_editor/duplicate_selected_bus", TTR("Duplicate Bus"), KeyModifierMask::CMD | Key::D));
+	bus_popup->add_shortcut(ED_SHORTCUT("audio_bus_editor/delete_selected_bus", TTR("Delete Bus"), Key::KEY_DELETE));
 	bus_popup->set_item_disabled(1, is_master);
 	bus_popup->add_item(TTR("Reset Volume"));
 	bus_popup->connect("index_pressed", callable_mp(this, &EditorAudioBus::_bus_popup_pressed));

+ 4 - 4
editor/editor_command_palette.cpp

@@ -149,10 +149,10 @@ void EditorCommandPalette::_sbox_input(const Ref<InputEvent> &p_ie) {
 	Ref<InputEventKey> k = p_ie;
 	if (k.is_valid()) {
 		switch (k->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				search_options->gui_input(k);
 			} break;
 			default:

+ 1 - 1
editor/editor_command_palette.h

@@ -99,6 +99,6 @@ public:
 	static EditorCommandPalette *get_singleton();
 };
 
-Ref<Shortcut> ED_SHORTCUT_AND_COMMAND(const String &p_path, const String &p_name, Key p_keycode = KEY_NONE, String p_command = "");
+Ref<Shortcut> ED_SHORTCUT_AND_COMMAND(const String &p_path, const String &p_name, Key p_keycode = Key::NONE, String p_command = "");
 
 #endif //EDITOR_COMMAND_PALETTE_H

+ 15 - 15
editor/editor_file_dialog.cpp

@@ -598,7 +598,7 @@ void EditorFileDialog::_item_list_item_rmb_selected(int p_item, const Vector2 &p
 		item_menu->add_icon_item(item_list->get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), TTR("Copy Path"), ITEM_MENU_COPY_PATH);
 	}
 	if (allow_delete) {
-		item_menu->add_icon_item(item_list->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete"), ITEM_MENU_DELETE, KEY_DELETE);
+		item_menu->add_icon_item(item_list->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete"), ITEM_MENU_DELETE, Key::KEY_DELETE);
 	}
 	if (single_item_selected) {
 		item_menu->add_separator();
@@ -623,9 +623,9 @@ void EditorFileDialog::_item_list_rmb_clicked(const Vector2 &p_pos) {
 	item_menu->set_size(Size2(1, 1));
 
 	if (can_create_dir) {
-		item_menu->add_icon_item(item_list->get_theme_icon(SNAME("folder"), SNAME("FileDialog")), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KEY_MASK_CMD | KEY_N);
+		item_menu->add_icon_item(item_list->get_theme_icon(SNAME("folder"), SNAME("FileDialog")), TTR("New Folder..."), ITEM_MENU_NEW_FOLDER, KeyModifierMask::CMD | Key::N);
 	}
-	item_menu->add_icon_item(item_list->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")), TTR("Refresh"), ITEM_MENU_REFRESH, KEY_F5);
+	item_menu->add_icon_item(item_list->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")), TTR("Refresh"), ITEM_MENU_REFRESH, Key::F5);
 	item_menu->add_separator();
 	item_menu->add_icon_item(item_list->get_theme_icon(SNAME("Filesystem"), SNAME("EditorIcons")), TTR("Open in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
 
@@ -1476,18 +1476,18 @@ EditorFileDialog::EditorFileDialog() {
 	mode = FILE_MODE_SAVE_FILE;
 	set_title(TTR("Save a File"));
 
-	ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT | KEY_LEFT);
-	ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KEY_MASK_ALT | KEY_RIGHT);
-	ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KEY_MASK_ALT | KEY_UP);
-	ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_F5);
-	ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KEY_MASK_CMD | KEY_H);
-	ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT | KEY_F);
-	ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT | KEY_V);
-	ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD | KEY_N);
-	ED_SHORTCUT("file_dialog/delete", TTR("Delete"), KEY_DELETE);
-	ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD | KEY_D);
-	ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KEY_MASK_CMD | KEY_UP);
-	ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KEY_MASK_CMD | KEY_DOWN);
+	ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KeyModifierMask::ALT | Key::LEFT);
+	ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KeyModifierMask::ALT | Key::RIGHT);
+	ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KeyModifierMask::ALT | Key::UP);
+	ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), Key::F5);
+	ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KeyModifierMask::CMD | Key::H);
+	ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KeyModifierMask::ALT | Key::F);
+	ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KeyModifierMask::ALT | Key::V);
+	ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KeyModifierMask::CMD | Key::N);
+	ED_SHORTCUT("file_dialog/delete", TTR("Delete"), Key::KEY_DELETE);
+	ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KeyModifierMask::CMD | Key::D);
+	ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KeyModifierMask::CMD | Key::UP);
+	ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KeyModifierMask::CMD | Key::DOWN);
 
 	HBoxContainer *pathhb = memnew(HBoxContainer);
 

+ 2 - 2
editor/editor_help.cpp

@@ -2023,7 +2023,7 @@ void FindBar::unhandled_input(const Ref<InputEvent> &p_event) {
 			bool accepted = true;
 
 			switch (k->get_keycode()) {
-				case KEY_ESCAPE: {
+				case Key::ESCAPE: {
 					_hide_bar();
 				} break;
 				default: {
@@ -2043,7 +2043,7 @@ void FindBar::_search_text_changed(const String &p_text) {
 }
 
 void FindBar::_search_text_submitted(const String &p_text) {
-	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		search_prev();
 	} else {
 		search_next();

+ 4 - 4
editor/editor_help_search.cpp

@@ -67,10 +67,10 @@ void EditorHelpSearch::_search_box_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventKey> key = p_event;
 	if (key.is_valid()) {
 		switch (key->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				results_tree->gui_input(key);
 				search_box->accept_event();
 			} break;

+ 10 - 10
editor/editor_inspector.cpp

@@ -571,7 +571,7 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) {
 		if (is_layout_rtl()) {
 			mpos.x = get_size().x - mpos.x;
 		}
-		bool button_left = me->get_button_mask() & MOUSE_BUTTON_MASK_LEFT;
+		bool button_left = (me->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE;
 
 		bool new_keying_hover = keying_rect.has_point(mpos) && !button_left;
 		if (new_keying_hover != keying_hover) {
@@ -600,7 +600,7 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) {
 
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		Vector2 mpos = mb->get_position();
 		if (is_layout_rtl()) {
 			mpos.x = get_size().x - mpos.x;
@@ -647,7 +647,7 @@ void EditorProperty::gui_input(const Ref<InputEvent> &p_event) {
 			update();
 			emit_signal(SNAME("property_checked"), property, checked);
 		}
-	} else if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+	} else if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
 		_update_popup();
 		menu->set_position(get_screen_position() + get_local_mouse_position());
 		menu->set_size(Vector2(1, 1));
@@ -1222,7 +1222,7 @@ void EditorInspectorSection::_notification(int p_what) {
 			Color c = bg_color;
 			c.a *= 0.4;
 			if (foldable && header_rect.has_point(get_local_mouse_position())) {
-				c = c.lightened(Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT) ? -0.05 : 0.2);
+				c = c.lightened(Input::get_singleton()->is_mouse_button_pressed(MouseButton::LEFT) ? -0.05 : 0.2);
 			}
 			draw_rect(header_rect, c);
 
@@ -1340,7 +1340,7 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
 		int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
 		if (mb->get_position().y > font->get_height(font_size)) { //clicked outside
@@ -1543,7 +1543,7 @@ void EditorInspectorArray::_panel_gui_input(Ref<InputEvent> p_event, int p_index
 	if (key_ref.is_valid()) {
 		const InputEventKey &key = **key_ref;
 
-		if (array_elements[p_index].panel->has_focus() && key.is_pressed() && key.get_keycode() == KEY_DELETE) {
+		if (array_elements[p_index].panel->has_focus() && key.is_pressed() && key.get_keycode() == Key::KEY_DELETE) {
 			_move_element(begin_array_index + p_index, -1);
 			array_elements[p_index].panel->accept_event();
 		}
@@ -1551,7 +1551,7 @@ void EditorInspectorArray::_panel_gui_input(Ref<InputEvent> p_event, int p_index
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->get_button_index() == MouseButton::RIGHT) {
 			popup_array_index_pressed = begin_array_index + p_index;
 			rmb_popup->set_item_disabled(OPTION_MOVE_UP, popup_array_index_pressed == 0);
 			rmb_popup->set_item_disabled(OPTION_MOVE_DOWN, popup_array_index_pressed == count - 1);
@@ -3576,7 +3576,7 @@ EditorInspector::EditorInspector() {
 		refresh_countdown = 0.33;
 	}
 
-	ED_SHORTCUT("property_editor/copy_property", TTR("Copy Property"), KEY_MASK_CMD | KEY_C);
-	ED_SHORTCUT("property_editor/paste_property", TTR("Paste Property"), KEY_MASK_CMD | KEY_V);
-	ED_SHORTCUT("property_editor/copy_property_path", TTR("Copy Property Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C);
+	ED_SHORTCUT("property_editor/copy_property", TTR("Copy Property"), KeyModifierMask::CMD | Key::C);
+	ED_SHORTCUT("property_editor/paste_property", TTR("Paste Property"), KeyModifierMask::CMD | Key::V);
+	ED_SHORTCUT("property_editor/copy_property_path", TTR("Copy Property Path"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::C);
 }

+ 3 - 3
editor/editor_layouts_dialog.cpp

@@ -46,15 +46,15 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
 		}
 
 		switch (k->get_keycode()) {
-			case KEY_KP_ENTER:
-			case KEY_ENTER: {
+			case Key::KP_ENTER:
+			case Key::ENTER: {
 				if (get_hide_on_ok()) {
 					hide();
 				}
 				ok_pressed();
 				set_input_as_handled();
 			} break;
-			case KEY_ESCAPE: {
+			case Key::ESCAPE: {
 				hide();
 				set_input_as_handled();
 			} break;

+ 3 - 3
editor/editor_log.cpp

@@ -366,7 +366,7 @@ EditorLog::EditorLog() {
 	clear_button = memnew(Button);
 	clear_button->set_flat(true);
 	clear_button->set_focus_mode(FOCUS_NONE);
-	clear_button->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K));
+	clear_button->set_shortcut(ED_SHORTCUT("editor/clear_output", TTR("Clear Output"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::K));
 	clear_button->set_shortcut_context(this);
 	clear_button->connect("pressed", callable_mp(this, &EditorLog::_clear_request));
 	hb_tools->add_child(clear_button);
@@ -375,7 +375,7 @@ EditorLog::EditorLog() {
 	copy_button = memnew(Button);
 	copy_button->set_flat(true);
 	copy_button->set_focus_mode(FOCUS_NONE);
-	copy_button->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KEY_MASK_CMD | KEY_C));
+	copy_button->set_shortcut(ED_SHORTCUT("editor/copy_output", TTR("Copy Selection"), KeyModifierMask::CMD | Key::C));
 	copy_button->set_shortcut_context(this);
 	copy_button->connect("pressed", callable_mp(this, &EditorLog::_copy_request));
 	hb_tools->add_child(copy_button);
@@ -401,7 +401,7 @@ EditorLog::EditorLog() {
 	show_search_button->set_focus_mode(FOCUS_NONE);
 	show_search_button->set_toggle_mode(true);
 	show_search_button->set_pressed(true);
-	show_search_button->set_shortcut(ED_SHORTCUT("editor/open_search", TTR("Focus Search/Filter Bar"), KEY_MASK_CMD | KEY_F));
+	show_search_button->set_shortcut(ED_SHORTCUT("editor/open_search", TTR("Focus Search/Filter Bar"), KeyModifierMask::CMD | Key::F));
 	show_search_button->set_shortcut_context(this);
 	show_search_button->connect("toggled", callable_mp(this, &EditorLog::_set_search_visible));
 	hb_tools2->add_child(show_search_button);

+ 57 - 57
editor/editor_node.cpp

@@ -2646,7 +2646,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
 		} break;
 
 		case EDIT_UNDO: {
-			if (Input::get_singleton()->get_mouse_button_mask() & 0x7) {
+			if ((int)Input::get_singleton()->get_mouse_button_mask() & 0x7) {
 				log->add_message(TTR("Can't undo while mouse buttons are pressed."), EditorLog::MSG_TYPE_EDITOR);
 			} else {
 				String action = editor_data.get_undo_redo().get_current_action_name();
@@ -2659,7 +2659,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
 			}
 		} break;
 		case EDIT_REDO: {
-			if (Input::get_singleton()->get_mouse_button_mask() & 0x7) {
+			if ((int)Input::get_singleton()->get_mouse_button_mask() & 0x7) {
 				log->add_message(TTR("Can't redo while mouse buttons are pressed."), EditorLog::MSG_TYPE_EDITOR);
 			} else {
 				if (!editor_data.get_undo_redo().redo()) {
@@ -4325,7 +4325,7 @@ void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
 
 		Ref<InputEventMouseButton> mb = me;
 
-		if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && dock_popup_selected != nrect) {
+		if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed() && dock_popup_selected != nrect) {
 			Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control();
 			if (dock) {
 				dock_slot[dock_popup_selected]->remove_child(dock);
@@ -5018,15 +5018,15 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
 
 	if (mb.is_valid()) {
 		if (scene_tabs->get_hovered_tab() >= 0) {
-			if (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed()) {
+			if (mb->get_button_index() == MouseButton::MIDDLE && mb->is_pressed()) {
 				_scene_tab_closed(scene_tabs->get_hovered_tab());
 			}
 		} else {
-			if ((mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_double_click()) || (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed())) {
+			if ((mb->get_button_index() == MouseButton::LEFT && mb->is_double_click()) || (mb->get_button_index() == MouseButton::MIDDLE && mb->is_pressed())) {
 				_menu_option_confirm(FILE_NEW_SCENE, true);
 			}
 		}
-		if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+		if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 			// context menu
 			scene_tabs_context_menu->clear();
 			scene_tabs_context_menu->set_size(Size2(1, 1));
@@ -5059,12 +5059,12 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
 			scene_tabs_context_menu->set_position(mb->get_global_position());
 			scene_tabs_context_menu->popup();
 		}
-		if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
+		if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed()) {
 			int previous_tab = editor_data.get_edited_scene() - 1;
 			previous_tab = previous_tab >= 0 ? previous_tab : editor_data.get_edited_scene_count() - 1;
 			_scene_tab_changed(previous_tab);
 		}
-		if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
+		if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_pressed()) {
 			int next_tab = editor_data.get_edited_scene() + 1;
 			next_tab %= editor_data.get_edited_scene_count();
 			_scene_tab_changed(next_tab);
@@ -6258,8 +6258,8 @@ EditorNode::EditorNode() {
 	tabbar_container->add_child(scene_tabs);
 	distraction_free = memnew(Button);
 	distraction_free->set_flat(true);
-	ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11);
-	ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D);
+	ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F11);
+	ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::CMD | KeyModifierMask::CTRL | Key::D);
 	distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode"));
 	distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
 	distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode));
@@ -6357,9 +6357,9 @@ EditorNode::EditorNode() {
 	gui_base->add_child(warning);
 	warning->connect("custom_action", callable_mp(this, &EditorNode::_copy_warning));
 
-	ED_SHORTCUT("editor/next_tab", TTR("Next Scene Tab"), KEY_MASK_CMD + KEY_TAB);
-	ED_SHORTCUT("editor/prev_tab", TTR("Previous Scene Tab"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_TAB);
-	ED_SHORTCUT("editor/filter_files", TTR("Focus FileSystem Filter"), KEY_MASK_CMD + KEY_MASK_ALT + KEY_P);
+	ED_SHORTCUT("editor/next_tab", TTR("Next Scene Tab"), KeyModifierMask::CMD + Key::TAB);
+	ED_SHORTCUT("editor/prev_tab", TTR("Previous Scene Tab"), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::TAB);
+	ED_SHORTCUT("editor/filter_files", TTR("Focus FileSystem Filter"), KeyModifierMask::CMD + KeyModifierMask::ALT + Key::P);
 
 	command_palette = EditorCommandPalette::get_singleton();
 	command_palette->set_title(TTR("Command Palette"));
@@ -6371,22 +6371,22 @@ EditorNode::EditorNode() {
 
 	p = file_menu->get_popup();
 
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_scene", TTR("New Scene"), KEY_MASK_CMD + KEY_N), FILE_NEW_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_inherited_scene", TTR("New Inherited Scene..."), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_N), FILE_NEW_INHERITED_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/open_scene", TTR("Open Scene..."), KEY_MASK_CMD + KEY_O), FILE_OPEN_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reopen_closed_scene", TTR("Reopen Closed Scene"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_T), FILE_OPEN_PREV);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_scene", TTR("New Scene"), KeyModifierMask::CMD + Key::N), FILE_NEW_SCENE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/new_inherited_scene", TTR("New Inherited Scene..."), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::N), FILE_NEW_INHERITED_SCENE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/open_scene", TTR("Open Scene..."), KeyModifierMask::CMD + Key::O), FILE_OPEN_SCENE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reopen_closed_scene", TTR("Reopen Closed Scene"), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::T), FILE_OPEN_PREV);
 	p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT);
 
 	p->add_separator();
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene", TTR("Save Scene"), KEY_MASK_CMD + KEY_S), FILE_SAVE_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene_as", TTR("Save Scene As..."), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_S), FILE_SAVE_AS_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_all_scenes", TTR("Save All Scenes"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_S), FILE_SAVE_ALL_SCENES);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene", TTR("Save Scene"), KeyModifierMask::CMD + Key::S), FILE_SAVE_SCENE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_scene_as", TTR("Save Scene As..."), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::S), FILE_SAVE_AS_SCENE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/save_all_scenes", TTR("Save All Scenes"), KeyModifierMask::CMD + KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::S), FILE_SAVE_ALL_SCENES);
 
 	p->add_separator();
 
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open", TTR("Quick Open..."), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_O), FILE_QUICK_OPEN);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_scene", TTR("Quick Open Scene..."), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_O), FILE_QUICK_OPEN_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_script", TTR("Quick Open Script..."), KEY_MASK_CMD + KEY_MASK_ALT + KEY_O), FILE_QUICK_OPEN_SCRIPT);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open", TTR("Quick Open..."), KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::O), FILE_QUICK_OPEN);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_scene", TTR("Quick Open Scene..."), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::O), FILE_QUICK_OPEN_SCENE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quick_open_script", TTR("Quick Open Script..."), KeyModifierMask::CMD + KeyModifierMask::ALT + Key::O), FILE_QUICK_OPEN_SCRIPT);
 
 	p->add_separator();
 	PopupMenu *pm_export = memnew(PopupMenu);
@@ -6402,7 +6402,7 @@ EditorNode::EditorNode() {
 
 	p->add_separator();
 	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/reload_saved_scene", TTR("Reload Saved Scene")), EDIT_RELOAD_SAVED_SCENE);
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTR("Close Scene"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_W), FILE_CLOSE);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTR("Close Scene"), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::W), FILE_CLOSE);
 
 	recent_scenes = memnew(PopupMenu);
 	recent_scenes->set_name("RecentScenes");
@@ -6410,7 +6410,7 @@ EditorNode::EditorNode() {
 	recent_scenes->connect("id_pressed", callable_mp(this, &EditorNode::_open_recent_scene));
 
 	p->add_separator();
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/file_quit", TTR("Quit"), KEY_MASK_CMD + KEY_Q), FILE_QUIT, true);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/file_quit", TTR("Quit"), KeyModifierMask::CMD + Key::Q), FILE_QUIT, true);
 
 	project_menu = memnew(MenuButton);
 	project_menu->set_flat(false);
@@ -6422,7 +6422,7 @@ EditorNode::EditorNode() {
 
 	p = project_menu->get_popup();
 
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/project_settings", TTR("Project Settings..."), KEY_NONE, TTR("Project Settings")), RUN_SETTINGS);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/project_settings", TTR("Project Settings..."), Key::NONE, TTR("Project Settings")), RUN_SETTINGS);
 	p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
 
 	vcs_actions_menu = VersionControlEditorPlugin::get_singleton()->get_version_control_actions_panel();
@@ -6435,7 +6435,7 @@ EditorNode::EditorNode() {
 	vcs_actions_menu->add_item(TTR("Shut Down Version Control"), RUN_VCS_SHUT_DOWN);
 
 	p->add_separator();
-	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/export", TTR("Export..."), KEY_NONE, TTR("Export")), FILE_EXPORT_PROJECT);
+	p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/export", TTR("Export..."), Key::NONE, TTR("Export")), FILE_EXPORT_PROJECT);
 	p->add_item(TTR("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE);
 	p->add_item(TTR("Open Project Data Folder"), RUN_PROJECT_DATA_FOLDER);
 
@@ -6452,8 +6452,8 @@ EditorNode::EditorNode() {
 
 	p->add_separator();
 	p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RUN_RELOAD_CURRENT_PROJECT);
-	ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Q);
-	ED_SHORTCUT_OVERRIDE("editor/quit_to_project_list", "macos", KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
+	ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KeyModifierMask::CMD + KeyModifierMask::SHIFT + Key::Q);
+	ED_SHORTCUT_OVERRIDE("editor/quit_to_project_list", "macos", KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::Q);
 	p->add_shortcut(ED_GET_SHORTCUT("editor/quit_to_project_list"), RUN_PROJECT_MANAGER, true);
 
 	menu_hb->add_spacer();
@@ -6481,9 +6481,9 @@ EditorNode::EditorNode() {
 	p = settings_menu->get_popup();
 
 	ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings..."));
-	ED_SHORTCUT_OVERRIDE("editor/editor_settings", "macos", KEY_MASK_CMD + KEY_COMMA);
+	ED_SHORTCUT_OVERRIDE("editor/editor_settings", "macos", KeyModifierMask::CMD + Key::COMMA);
 	p->add_shortcut(ED_GET_SHORTCUT("editor/editor_settings"), SETTINGS_PREFERENCES);
-	p->add_shortcut(ED_SHORTCUT("editor/command_palette", TTR("Command Palette..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_P), HELP_COMMAND_PALETTE);
+	p->add_shortcut(ED_SHORTCUT("editor/command_palette", TTR("Command Palette..."), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::P), HELP_COMMAND_PALETTE);
 	p->add_separator();
 
 	editor_layouts = memnew(PopupMenu);
@@ -6493,14 +6493,14 @@ EditorNode::EditorNode() {
 	p->add_submenu_item(TTR("Editor Layout"), "Layouts");
 	p->add_separator();
 
-	ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12);
-	ED_SHORTCUT_OVERRIDE("editor/take_screenshot", "macos", KEY_MASK_CMD | KEY_F12);
+	ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KeyModifierMask::CTRL | Key::F12);
+	ED_SHORTCUT_OVERRIDE("editor/take_screenshot", "macos", KeyModifierMask::CMD | Key::F12);
 	p->add_shortcut(ED_GET_SHORTCUT("editor/take_screenshot"), EDITOR_SCREENSHOT);
 
 	p->set_item_tooltip(p->get_item_count() - 1, TTR("Screenshots are stored in the Editor Data/Settings Folder."));
 
-	ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11);
-	ED_SHORTCUT_OVERRIDE("editor/fullscreen_mode", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F);
+	ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KeyModifierMask::SHIFT | Key::F11);
+	ED_SHORTCUT_OVERRIDE("editor/fullscreen_mode", "macos", KeyModifierMask::CMD | KeyModifierMask::CTRL | Key::F);
 	p->add_shortcut(ED_GET_SHORTCUT("editor/fullscreen_mode"), SETTINGS_TOGGLE_FULLSCREEN);
 
 #if defined(WINDOWS_ENABLED) && defined(WINDOWS_SUBSYSTEM_CONSOLE)
@@ -6534,8 +6534,8 @@ EditorNode::EditorNode() {
 	p = help_menu->get_popup();
 	p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));
 
-	ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_F1);
-	ED_SHORTCUT_OVERRIDE("editor/editor_help", "macos", KEY_MASK_ALT | KEY_SPACE);
+	ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), Key::F1);
+	ED_SHORTCUT_OVERRIDE("editor/editor_help", "macos", KeyModifierMask::ALT | Key::SPACE);
 	p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_GET_SHORTCUT("editor/editor_help"), HELP_SEARCH);
 	p->add_separator();
 	p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/online_docs", TTR("Online Documentation")), HELP_DOCS);
@@ -6560,8 +6560,8 @@ EditorNode::EditorNode() {
 	play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY));
 	play_button->set_tooltip(TTR("Play the project."));
 
-	ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_F5);
-	ED_SHORTCUT_OVERRIDE("editor/play", "macos", KEY_MASK_CMD | KEY_B);
+	ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), Key::F5);
+	ED_SHORTCUT_OVERRIDE("editor/play", "macos", KeyModifierMask::CMD | Key::B);
 	play_button->set_shortcut(ED_GET_SHORTCUT("editor/play"));
 
 	pause_button = memnew(Button);
@@ -6573,8 +6573,8 @@ EditorNode::EditorNode() {
 	pause_button->set_disabled(true);
 	play_hb->add_child(pause_button);
 
-	ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7);
-	ED_SHORTCUT_OVERRIDE("editor/pause_scene", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y);
+	ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), Key::F7);
+	ED_SHORTCUT_OVERRIDE("editor/pause_scene", "macos", KeyModifierMask::CMD | KeyModifierMask::CTRL | Key::Y);
 	pause_button->set_shortcut(ED_GET_SHORTCUT("editor/pause_scene"));
 
 	stop_button = memnew(Button);
@@ -6586,8 +6586,8 @@ EditorNode::EditorNode() {
 	stop_button->set_tooltip(TTR("Stop the scene."));
 	stop_button->set_disabled(true);
 
-	ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8);
-	ED_SHORTCUT_OVERRIDE("editor/stop", "macos", KEY_MASK_CMD | KEY_PERIOD);
+	ED_SHORTCUT("editor/stop", TTR("Stop"), Key::F8);
+	ED_SHORTCUT_OVERRIDE("editor/stop", "macos", KeyModifierMask::CMD | Key::PERIOD);
 	stop_button->set_shortcut(ED_GET_SHORTCUT("editor/stop"));
 
 	run_native = memnew(EditorRunNative);
@@ -6603,8 +6603,8 @@ EditorNode::EditorNode() {
 	play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE));
 	play_scene_button->set_tooltip(TTR("Play the edited scene."));
 
-	ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_F6);
-	ED_SHORTCUT_OVERRIDE("editor/play_scene", "macos", KEY_MASK_CMD | KEY_R);
+	ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), Key::F6);
+	ED_SHORTCUT_OVERRIDE("editor/play_scene", "macos", KeyModifierMask::CMD | Key::R);
 	play_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_scene"));
 
 	play_custom_scene_button = memnew(Button);
@@ -6616,8 +6616,8 @@ EditorNode::EditorNode() {
 	play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE));
 	play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
 
-	ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5);
-	ED_SHORTCUT_OVERRIDE("editor/play_custom_scene", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R);
+	ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F5);
+	ED_SHORTCUT_OVERRIDE("editor/play_custom_scene", "macos", KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::R);
 	play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_custom_scene"));
 
 	HBoxContainer *right_menu_hb = memnew(HBoxContainer);
@@ -6804,7 +6804,7 @@ EditorNode::EditorNode() {
 	bottom_panel_raise->set_flat(true);
 	bottom_panel_raise->set_icon(gui_base->get_theme_icon(SNAME("ExpandBottomDock"), SNAME("EditorIcons")));
 
-	bottom_panel_raise->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KEY_MASK_SHIFT | KEY_F12));
+	bottom_panel_raise->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/bottom_panel_expand", TTR("Expand Bottom Panel"), KeyModifierMask::SHIFT | Key::F12));
 
 	bottom_panel_hb->add_child(bottom_panel_raise);
 	bottom_panel_raise->hide();
@@ -7174,15 +7174,15 @@ EditorNode::EditorNode() {
 	ResourceLoader::set_load_callback(_resource_loaded);
 
 	// Use the Ctrl modifier so F2 can be used to rename nodes in the scene tree dock.
-	ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_CTRL | KEY_F1);
-	ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_CTRL | KEY_F2);
-	ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_CTRL | KEY_F3);
-	ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_CTRL | KEY_F4);
-
-	ED_SHORTCUT_OVERRIDE("editor/editor_2d", "macos", KEY_MASK_ALT | KEY_1);
-	ED_SHORTCUT_OVERRIDE("editor/editor_3d", "macos", KEY_MASK_ALT | KEY_2);
-	ED_SHORTCUT_OVERRIDE("editor/editor_script", "macos", KEY_MASK_ALT | KEY_3);
-	ED_SHORTCUT_OVERRIDE("editor/editor_assetlib", "macos", KEY_MASK_ALT | KEY_4);
+	ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KeyModifierMask::CTRL | Key::F1);
+	ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KeyModifierMask::CTRL | Key::F2);
+	ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KeyModifierMask::CTRL | Key::F3);
+	ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KeyModifierMask::CTRL | Key::F4);
+
+	ED_SHORTCUT_OVERRIDE("editor/editor_2d", "macos", KeyModifierMask::ALT | Key::KEY_1);
+	ED_SHORTCUT_OVERRIDE("editor/editor_3d", "macos", KeyModifierMask::ALT | Key::KEY_2);
+	ED_SHORTCUT_OVERRIDE("editor/editor_script", "macos", KeyModifierMask::ALT | Key::KEY_3);
+	ED_SHORTCUT_OVERRIDE("editor/editor_assetlib", "macos", KeyModifierMask::ALT | Key::KEY_4);
 
 	ED_SHORTCUT_AND_COMMAND("editor/editor_next", TTR("Open the next Editor"));
 	ED_SHORTCUT_AND_COMMAND("editor/editor_prev", TTR("Open the previous Editor"));

+ 5 - 5
editor/editor_properties.cpp

@@ -818,7 +818,7 @@ public:
 		}
 
 		const Ref<InputEventMouseButton> mb = p_ev;
-		if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
+		if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
 			if (hovered_index >= 0) {
 				// Toggle the flag.
 				// We base our choice on the hovered flag, so that it always matches the hovered flag.
@@ -1278,11 +1278,11 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
 	}
 	const Ref<InputEventMouseButton> mb = p_ev;
 	if (mb.is_valid()) {
-		if (mb->is_double_click() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->is_double_click() && mb->get_button_index() == MouseButton::LEFT) {
 			_setup_spin();
 		}
 
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
 			preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position()));
 			preset->popup();
 
@@ -1291,7 +1291,7 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
 			easing_draw->update();
 		}
 
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			dragging = mb->is_pressed();
 			// Update to display the correct dragging color
 			easing_draw->update();
@@ -1300,7 +1300,7 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
 
 	const Ref<InputEventMouseMotion> mm = p_ev;
 
-	if (dragging && mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (dragging && mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		float rel = mm->get_relative().x;
 		if (rel == 0) {
 			return;

+ 1 - 1
editor/editor_resource_picker.cpp

@@ -464,7 +464,7 @@ void EditorResourcePicker::_button_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseButton> mb = p_event;
 
 	if (mb.is_valid()) {
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
 			_update_menu_items();
 
 			Vector2 pos = get_screen_position() + mb->get_position();

+ 8 - 9
editor/editor_settings.cpp

@@ -1482,7 +1482,7 @@ void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_k
 	ERR_FAIL_COND_MSG(!sc.is_valid(), "Used ED_SHORTCUT_OVERRIDE with invalid shortcut: " + p_path + ".");
 
 	PackedInt32Array arr;
-	arr.push_back(p_keycode);
+	arr.push_back((int32_t)p_keycode);
 
 	ED_SHORTCUT_OVERRIDE_ARRAY(p_path, p_feature, arr);
 }
@@ -1503,13 +1503,12 @@ void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, c
 
 #ifdef OSX_ENABLED
 		// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
-		if (keycode == KEY_DELETE) {
-			keycode = KEY_MASK_CMD | KEY_BACKSPACE;
+		if (keycode == Key::KEY_DELETE) {
+			keycode = KeyModifierMask::CMD | Key::BACKSPACE;
 		}
 #endif
-
 		Ref<InputEventKey> ie;
-		if (keycode) {
+		if (keycode != Key::NONE) {
 			ie = InputEventKey::create_reference(keycode);
 			events.push_back(ie);
 		}
@@ -1522,7 +1521,7 @@ void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, c
 
 Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode) {
 	PackedInt32Array arr;
-	arr.push_back(p_keycode);
+	arr.push_back((int32_t)p_keycode);
 	return ED_SHORTCUT_ARRAY(p_path, p_name, arr);
 }
 
@@ -1534,13 +1533,13 @@ Ref<Shortcut> ED_SHORTCUT_ARRAY(const String &p_path, const String &p_name, cons
 
 #ifdef OSX_ENABLED
 		// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
-		if (keycode == KEY_DELETE) {
-			keycode = KEY_MASK_CMD | KEY_BACKSPACE;
+		if (keycode == Key::KEY_DELETE) {
+			keycode = KeyModifierMask::CMD | Key::BACKSPACE;
 		}
 #endif
 
 		Ref<InputEventKey> ie;
-		if (keycode) {
+		if (keycode != Key::NONE) {
 			ie = InputEventKey::create_reference(keycode);
 			events.push_back(ie);
 		}

+ 2 - 2
editor/editor_settings.h

@@ -200,9 +200,9 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re
 Variant _EDITOR_GET(const String &p_setting);
 
 #define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev))
-Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode = KEY_NONE);
+Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, Key p_keycode = Key::NONE);
 Ref<Shortcut> ED_SHORTCUT_ARRAY(const String &p_path, const String &p_name, const PackedInt32Array &p_keycodes);
-void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode = KEY_NONE);
+void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode = Key::NONE);
 void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, const PackedInt32Array &p_keycodes);
 Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path);
 

+ 12 - 10
editor/editor_spin_slider.cpp

@@ -39,9 +39,9 @@
 String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
 	if (grabber->is_visible()) {
 #ifdef OSX_ENABLED
-		const int key = KEY_META;
+		Key key = Key::META;
 #else
-		const int key = KEY_CTRL;
+		Key key = Key::CTRL;
 #endif
 		return TS->format_number(rtos(get_value())) + "\n\n" + vformat(TTR("Hold %s to round to integers. Hold Shift for more precise changes."), find_keycode_name(key));
 	}
@@ -61,7 +61,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (updown_offset != -1 && mb->get_position().x > updown_offset) {
 					//there is an updown, so use it.
@@ -92,7 +92,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
 					grabbing_spinner_attempt = false;
 				}
 			}
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP || mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_UP || mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 			if (grabber->is_visible()) {
 				call_deferred(SNAME("update"));
 			}
@@ -154,17 +154,17 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
 
 	if (grabbing_grabber) {
 		if (mb.is_valid()) {
-			if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+			if (mb->get_button_index() == MouseButton::WHEEL_UP) {
 				set_value(get_value() + get_step());
 				mousewheel_over_grabber = true;
-			} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+			} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 				set_value(get_value() - get_step());
 				mousewheel_over_grabber = true;
 			}
 		}
 	}
 
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_pressed()) {
 			grabbing_grabber = true;
 			if (!mousewheel_over_grabber) {
@@ -212,9 +212,9 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
 			step *= 0.1;
 		}
 
-		uint32_t code = k->get_keycode();
+		Key code = k->get_keycode();
 		switch (code) {
-			case KEY_UP: {
+			case Key::UP: {
 				_evaluate_input_text();
 
 				double last_value = get_value();
@@ -228,7 +228,7 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
 				value_input_dirty = true;
 				set_process_internal(true);
 			} break;
-			case KEY_DOWN: {
+			case Key::DOWN: {
 				_evaluate_input_text();
 
 				double last_value = get_value();
@@ -242,6 +242,8 @@ void EditorSpinSlider::_value_input_gui_input(const Ref<InputEvent> &p_event) {
 				value_input_dirty = true;
 				set_process_internal(true);
 			} break;
+			default:
+				break;
 		}
 	}
 }

+ 5 - 5
editor/editor_zoom_widget.cpp

@@ -51,7 +51,7 @@ void EditorZoomWidget::_update_zoom_label() {
 }
 
 void EditorZoomWidget::_button_zoom_minus() {
-	set_zoom_by_increments(-6, Input::get_singleton()->is_key_pressed(KEY_ALT));
+	set_zoom_by_increments(-6, Input::get_singleton()->is_key_pressed(Key::ALT));
 	emit_signal(SNAME("zoom_changed"), zoom);
 }
 
@@ -61,7 +61,7 @@ void EditorZoomWidget::_button_zoom_reset() {
 }
 
 void EditorZoomWidget::_button_zoom_plus() {
-	set_zoom_by_increments(6, Input::get_singleton()->is_key_pressed(KEY_ALT));
+	set_zoom_by_increments(6, Input::get_singleton()->is_key_pressed(Key::ALT));
 	emit_signal(SNAME("zoom_changed"), zoom);
 }
 
@@ -169,7 +169,7 @@ EditorZoomWidget::EditorZoomWidget() {
 	zoom_minus->set_flat(true);
 	add_child(zoom_minus);
 	zoom_minus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_minus));
-	zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS));
+	zoom_minus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_minus", TTR("Zoom Out"), KeyModifierMask::CMD | Key::MINUS));
 	zoom_minus->set_shortcut_context(this);
 	zoom_minus->set_focus_mode(FOCUS_NONE);
 
@@ -180,7 +180,7 @@ EditorZoomWidget::EditorZoomWidget() {
 	zoom_reset->add_theme_color_override("font_outline_color", Color(0, 0, 0));
 	zoom_reset->add_theme_color_override("font_color", Color(1, 1, 1));
 	zoom_reset->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_reset));
-	zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KEY_MASK_CMD | KEY_0));
+	zoom_reset->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset"), KeyModifierMask::CMD | Key::KEY_0));
 	zoom_reset->set_shortcut_context(this);
 	zoom_reset->set_focus_mode(FOCUS_NONE);
 	zoom_reset->set_text_align(Button::TextAlign::ALIGN_CENTER);
@@ -191,7 +191,7 @@ EditorZoomWidget::EditorZoomWidget() {
 	zoom_plus->set_flat(true);
 	add_child(zoom_plus);
 	zoom_plus->connect("pressed", callable_mp(this, &EditorZoomWidget::_button_zoom_plus));
-	zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS
+	zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom In"), KeyModifierMask::CMD | Key::EQUAL)); // Usually direct access key for PLUS
 	zoom_plus->set_shortcut_context(this);
 	zoom_plus->set_focus_mode(FOCUS_NONE);
 

+ 7 - 7
editor/filesystem_dock.cpp

@@ -2273,7 +2273,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
 				}
 			}
 			if (!to_move.is_empty()) {
-				if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+				if (Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 					for (int i = 0; i < to_move.size(); i++) {
 						String new_path;
 						String new_path_base;
@@ -2794,12 +2794,12 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
 	editor = p_editor;
 	path = "res://";
 
-	// `KEY_MASK_CMD | KEY_C` conflicts with other editor shortcuts.
-	ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C);
-	ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
-	ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE);
-	ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), KEY_F2);
-	ED_SHORTCUT_OVERRIDE("filesystem_dock/rename", "macos", KEY_ENTER);
+	// `KeyModifierMask::CMD | Key::C` conflicts with other editor shortcuts.
+	ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::C);
+	ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KeyModifierMask::CMD | Key::D);
+	ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), Key::KEY_DELETE);
+	ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
+	ED_SHORTCUT_OVERRIDE("filesystem_dock/rename", "macos", Key::ENTER);
 
 	VBoxContainer *top_vbc = memnew(VBoxContainer);
 	add_child(top_vbc);

+ 3 - 3
editor/import/scene_import_settings.cpp

@@ -737,21 +737,21 @@ void SceneImportSettings::_viewport_input(const Ref<InputEvent> &p_input) {
 		zoom = &md.cam_zoom;
 	}
 	Ref<InputEventMouseMotion> mm = p_input;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		(*rot_x) -= mm->get_relative().y * 0.01 * EDSCALE;
 		(*rot_y) -= mm->get_relative().x * 0.01 * EDSCALE;
 		(*rot_x) = CLAMP((*rot_x), -Math_PI / 2, Math_PI / 2);
 		_update_camera();
 	}
 	Ref<InputEventMouseButton> mb = p_input;
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 		(*zoom) *= 1.1;
 		if ((*zoom) > 10.0) {
 			(*zoom) = 10.0;
 		}
 		_update_camera();
 	}
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 		(*zoom) /= 1.1;
 		if ((*zoom) < 0.1) {
 			(*zoom) = 0.1;

+ 11 - 11
editor/plugins/abstract_polygon_2d_editor.cpp

@@ -245,11 +245,11 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 	Ref<InputEventMouseButton> mb = p_event;
 
 	if (!_has_resource()) {
-		if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
+		if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
 			create_resource->set_text(String("No polygon resource on this node.\nCreate and assign one?"));
 			create_resource->popup_centered();
 		}
-		return (mb.is_valid() && mb->get_button_index() == 1);
+		return (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT);
 	}
 
 	CanvasItemEditor::Tool tool = CanvasItemEditor::get_singleton()->get_current_tool();
@@ -264,7 +264,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 		Vector2 cpoint = _get_node()->to_local(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
 
 		if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
-			if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+			if (mb->get_button_index() == MouseButton::LEFT) {
 				if (mb->is_pressed()) {
 					if (mb->is_ctrl_pressed() || mb->is_shift_pressed() || mb->is_alt_pressed()) {
 						return false;
@@ -326,7 +326,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 						return true;
 					}
 				}
-			} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && !edited_point.valid()) {
+			} else if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed() && !edited_point.valid()) {
 				const PosVertex closest = closest_point(gpoint);
 
 				if (closest.valid()) {
@@ -335,7 +335,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 				}
 			}
 		} else if (mode == MODE_DELETE) {
-			if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
+			if (mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
 				const PosVertex closest = closest_point(gpoint);
 
 				if (closest.valid()) {
@@ -346,7 +346,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 		}
 
 		if (mode == MODE_CREATE) {
-			if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
+			if (mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
 				if (_is_line()) {
 					// for lines, we don't have a wip mode, and we can undo each single add point.
 					Vector<Vector2> vertices = _get_polygon(0);
@@ -384,7 +384,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 						return true;
 					}
 				}
-			} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+			} else if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed() && wip_active) {
 				_wip_cancel();
 			}
 		}
@@ -395,7 +395,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 	if (mm.is_valid()) {
 		Vector2 gpoint = mm->get_position();
 
-		if (edited_point.valid() && (wip_active || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT))) {
+		if (edited_point.valid() && (wip_active || (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE)) {
 			Vector2 cpoint = _get_node()->to_local(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
 
 			//Move the point in a single axis. Should only work when editing a polygon and while holding shift.
@@ -443,7 +443,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 	Ref<InputEventKey> k = p_event;
 
 	if (k.is_valid() && k->is_pressed()) {
-		if (k->get_keycode() == KEY_DELETE || k->get_keycode() == KEY_BACKSPACE) {
+		if (k->get_keycode() == Key::KEY_DELETE || k->get_keycode() == Key::BACKSPACE) {
 			if (wip_active && selected_point.polygon == -1) {
 				if (wip.size() > selected_point.vertex) {
 					wip.remove(selected_point.vertex);
@@ -460,9 +460,9 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
 					return true;
 				}
 			}
-		} else if (wip_active && k->get_keycode() == KEY_ENTER) {
+		} else if (wip_active && k->get_keycode() == Key::ENTER) {
 			_wip_close();
-		} else if (wip_active && k->get_keycode() == KEY_ESCAPE) {
+		} else if (wip_active && k->get_keycode() == Key::ESCAPE) {
 			_wip_cancel();
 		}
 	}

+ 6 - 6
editor/plugins/animation_blend_space_1d_editor.cpp

@@ -42,7 +42,7 @@ StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
 void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventKey> k = p_event;
 
-	if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
+	if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == Key::KEY_DELETE && !k->is_echo()) {
 		if (selected_point != -1) {
 			_erase_selected();
 			accept_event();
@@ -51,7 +51,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
 
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && tool_create->is_pressed()))) {
+	if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) || (mb->get_button_index() == MouseButton::LEFT && tool_create->is_pressed()))) {
 		menu->clear();
 		animations_menu->clear();
 		animations_to_add.clear();
@@ -110,7 +110,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
 		}
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		blend_space_draw->update(); // why not
 
 		// try to see if a point can be selected
@@ -132,7 +132,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
 		}
 	}
 
-	if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MouseButton::LEFT) {
 		if (dragging_selected) {
 			// move
 			float point = blend_space->get_blend_point_position(selected_point);
@@ -161,7 +161,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
 	}
 
 	// *set* the blend
-	if (mb.is_valid() && !mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && !mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		float blend_pos = mb->get_position().x / blend_space_draw->get_size().x;
 		blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
 		blend_pos += blend_space->get_min_space();
@@ -184,7 +184,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
 		_update_edited_point_pos();
 	}
 
-	if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && tool_blend->is_pressed() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		float blend_pos = mm->get_position().x / blend_space_draw->get_size().x;
 		blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
 		blend_pos += blend_space->get_min_space();

+ 7 - 7
editor/plugins/animation_blend_space_2d_editor.cpp

@@ -70,7 +70,7 @@ StringName AnimationNodeBlendSpace2DEditor::get_blend_position_path() const {
 
 void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventKey> k = p_event;
-	if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
+	if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == Key::KEY_DELETE && !k->is_echo()) {
 		if (selected_point != -1 || selected_triangle != -1) {
 			_erase_selected();
 			accept_event();
@@ -79,7 +79,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
 
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && tool_create->is_pressed()))) {
+	if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) || (mb->get_button_index() == MouseButton::LEFT && tool_create->is_pressed()))) {
 		menu->clear();
 		animations_menu->clear();
 		animations_to_add.clear();
@@ -133,7 +133,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
 		}
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		blend_space_draw->update(); //update anyway
 		//try to see if a point can be selected
 		selected_point = -1;
@@ -173,7 +173,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
 		}
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		blend_space_draw->update(); //update anyway
 		//try to see if a point can be selected
 		selected_point = -1;
@@ -208,7 +208,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
 		}
 	}
 
-	if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MouseButton::LEFT) {
 		if (dragging_selected) {
 			//move
 			Vector2 point = blend_space->get_blend_point_position(selected_point);
@@ -234,7 +234,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
 		blend_space_draw->update();
 	}
 
-	if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		Vector2 blend_pos = (mb->get_position() / blend_space_draw->get_size());
 		blend_pos.y = 1.0 - blend_pos.y;
 		blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
@@ -268,7 +268,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
 		blend_space_draw->update();
 	}
 
-	if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && tool_blend->is_pressed() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		Vector2 blend_pos = (mm->get_position() / blend_space_draw->get_size());
 		blend_pos.y = 1.0 - blend_pos.y;
 		blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());

+ 4 - 4
editor/plugins/animation_player_editor_plugin.cpp

@@ -475,7 +475,7 @@ double AnimationPlayerEditor::_get_editor_step() const {
 		ERR_FAIL_COND_V(!anim.is_valid(), 0.0);
 
 		// Use more precise snapping when holding Shift
-		return Input::get_singleton()->is_key_pressed(KEY_SHIFT) ? anim->get_step() * 0.25 : anim->get_step();
+		return Input::get_singleton()->is_key_pressed(Key::SHIFT) ? anim->get_step() * 0.25 : anim->get_step();
 	}
 
 	return 0.0;
@@ -1229,7 +1229,7 @@ void AnimationPlayerEditor::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 	Ref<InputEventKey> k = p_ev;
 	if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->is_alt_pressed() && !k->is_ctrl_pressed() && !k->is_meta_pressed()) {
 		switch (k->get_keycode()) {
-			case KEY_A: {
+			case Key::A: {
 				if (!k->is_shift_pressed()) {
 					_play_bw_from_pressed();
 				} else {
@@ -1237,11 +1237,11 @@ void AnimationPlayerEditor::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 				}
 				accept_event();
 			} break;
-			case KEY_S: {
+			case Key::S: {
 				_stop_pressed();
 				accept_event();
 			} break;
-			case KEY_D: {
+			case Key::D: {
 				if (!k->is_shift_pressed()) {
 					_play_from_pressed();
 				} else {

+ 7 - 7
editor/plugins/animation_state_machine_editor.cpp

@@ -66,7 +66,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	}
 
 	Ref<InputEventKey> k = p_event;
-	if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
+	if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == Key::KEY_DELETE && !k->is_echo()) {
 		if (selected_node != StringName() || selected_transition_to != StringName() || selected_transition_from != StringName()) {
 			_erase_selected();
 			accept_event();
@@ -76,7 +76,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	Ref<InputEventMouseButton> mb = p_event;
 
 	//Add new node
-	if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT))) {
+	if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == MouseButton::LEFT))) {
 		menu->clear();
 		animations_menu->clear();
 		animations_to_add.clear();
@@ -124,7 +124,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	}
 
 	// select node or push a field inside
-	if (mb.is_valid() && !mb->is_shift_pressed() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && !mb->is_shift_pressed() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		selected_transition_from = StringName();
 		selected_transition_to = StringName();
 		selected_node = StringName();
@@ -216,7 +216,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	}
 
 	//end moving node
-	if (mb.is_valid() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
+	if (mb.is_valid() && dragging_selected_attempt && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed()) {
 		if (dragging_selected) {
 			Ref<AnimationNode> an = state_machine->get_node(selected_node);
 			updating = true;
@@ -237,7 +237,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	}
 
 	//connect nodes
-	if (mb.is_valid() && ((tool_select->is_pressed() && mb->is_shift_pressed()) || tool_connect->is_pressed()) && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
+	if (mb.is_valid() && ((tool_select->is_pressed() && mb->is_shift_pressed()) || tool_connect->is_pressed()) && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
 		for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
 			if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected
 				connecting = true;
@@ -250,7 +250,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	}
 
 	//end connecting nodes
-	if (mb.is_valid() && connecting && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
+	if (mb.is_valid() && connecting && mb->get_button_index() == MouseButton::LEFT && !mb->is_pressed()) {
 		if (connecting_to_node != StringName()) {
 			if (state_machine->has_transition(connecting_from, connecting_to_node)) {
 				EditorNode::get_singleton()->show_warning(TTR("Transition exists!"));
@@ -284,7 +284,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
 	Ref<InputEventMouseMotion> mm = p_event;
 
 	//pan window
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) {
 		h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
 		v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
 	}

+ 1 - 1
editor/plugins/asset_library_editor_plugin.cpp

@@ -620,7 +620,7 @@ void EditorAssetLibrary::unhandled_key_input(const Ref<InputEvent> &p_event) {
 	const Ref<InputEventKey> key = p_event;
 
 	if (key.is_valid() && key->is_pressed()) {
-		if (key->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F) && is_visible_in_tree()) {
+		if (key->get_keycode_with_modifiers() == (KeyModifierMask::CMD | Key::F) && is_visible_in_tree()) {
 			filter->grab_focus();
 			filter->select_all();
 			accept_event();

+ 2 - 2
editor/plugins/audio_stream_editor_plugin.cpp

@@ -157,7 +157,7 @@ void AudioStreamEditor::_draw_indicator() {
 
 void AudioStreamEditor::_on_input_indicator(Ref<InputEvent> p_event) {
 	const Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_pressed()) {
 			_seek_to(mb->get_position().x);
 		}
@@ -232,7 +232,7 @@ AudioStreamEditor::AudioStreamEditor() {
 	hbox->add_child(_play_button);
 	_play_button->set_focus_mode(Control::FOCUS_NONE);
 	_play_button->connect("pressed", callable_mp(this, &AudioStreamEditor::_play));
-	_play_button->set_shortcut(ED_SHORTCUT("inspector/audio_preview_play_pause", TTR("Audio Preview Play/Pause"), KEY_SPACE));
+	_play_button->set_shortcut(ED_SHORTCUT("inspector/audio_preview_play_pause", TTR("Audio Preview Play/Pause"), Key::SPACE));
 
 	_stop_button = memnew(Button);
 	_stop_button->set_flat(true);

+ 98 - 98
editor/plugins/canvas_item_editor_plugin.cpp

@@ -333,7 +333,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
 	snap_target[0] = SNAP_TARGET_NONE;
 	snap_target[1] = SNAP_TARGET_NONE;
 
-	bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(KEY_CTRL);
+	bool is_snap_active = smart_snap_active ^ Input::get_singleton()->is_key_pressed(Key::CTRL);
 
 	// Smart snap using the canvas position
 	Vector2 output = p_target;
@@ -461,7 +461,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
 }
 
 real_t CanvasItemEditor::snap_angle(real_t p_target, real_t p_start) const {
-	if (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(KEY_CTRL)) && snap_rotation_step != 0) {
+	if (((smart_snap_active || snap_rotation) ^ Input::get_singleton()->is_key_pressed(Key::CTRL)) && snap_rotation_step != 0) {
 		if (snap_relative) {
 			return Math::snapped(p_target - snap_rotation_offset, snap_rotation_step) + snap_rotation_offset + (p_start - (int)(p_start / snap_rotation_step) * snap_rotation_step);
 		} else {
@@ -482,7 +482,7 @@ void CanvasItemEditor::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 	}
 
 	if (k.is_valid()) {
-		if (k->get_keycode() == KEY_CTRL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
+		if (k->get_keycode() == Key::CTRL || k->get_keycode() == Key::ALT || k->get_keycode() == Key::SHIFT) {
 			viewport->update();
 		}
 
@@ -950,7 +950,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
 			}
 
 			// Start dragging a guide
-			if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
+			if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed()) {
 				// Press button
 				if (b->get_position().x < RULER_WIDTH && b->get_position().y < RULER_WIDTH) {
 					// Drag a new double guide
@@ -1009,7 +1009,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
 		}
 
 		// Release confirms the guide move
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
 			if (show_guides && EditorNode::get_singleton()->get_edited_scene()) {
 				Transform2D xform = viewport_scrollable->get_transform() * transform;
 
@@ -1123,7 +1123,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
 		if (pan_on_scroll) {
 			// Perform horizontal scrolling first so we can check for Shift being held.
 			if (b->is_pressed() &&
-					(b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->is_shift_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP))) {
+					(b->get_button_index() == MouseButton::WHEEL_LEFT || (b->is_shift_pressed() && b->get_button_index() == MouseButton::WHEEL_UP))) {
 				// Pan left
 				view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
 				update_viewport();
@@ -1131,7 +1131,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
 			}
 
 			if (b->is_pressed() &&
-					(b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->is_shift_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN))) {
+					(b->get_button_index() == MouseButton::WHEEL_RIGHT || (b->is_shift_pressed() && b->get_button_index() == MouseButton::WHEEL_DOWN))) {
 				// Pan right
 				view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
 				update_viewport();
@@ -1139,13 +1139,13 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
 			}
 		}
 
-		if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+		if (b->is_pressed() && b->get_button_index() == MouseButton::WHEEL_DOWN) {
 			// Scroll or pan down
 			if (pan_on_scroll) {
 				view_offset.y += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
 				update_viewport();
 			} else {
-				zoom_widget->set_zoom_by_increments(-1, Input::get_singleton()->is_key_pressed(KEY_ALT));
+				zoom_widget->set_zoom_by_increments(-1, Input::get_singleton()->is_key_pressed(Key::ALT));
 				if (!Math::is_equal_approx(b->get_factor(), 1.0f)) {
 					// Handle high-precision (analog) scrolling.
 					zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * b->get_factor() + 1.f));
@@ -1155,13 +1155,13 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
 			return true;
 		}
 
-		if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+		if (b->is_pressed() && b->get_button_index() == MouseButton::WHEEL_UP) {
 			// Scroll or pan up
 			if (pan_on_scroll) {
 				view_offset.y -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
 				update_viewport();
 			} else {
-				zoom_widget->set_zoom_by_increments(1, Input::get_singleton()->is_key_pressed(KEY_ALT));
+				zoom_widget->set_zoom_by_increments(1, Input::get_singleton()->is_key_pressed(Key::ALT));
 				if (!Math::is_equal_approx(b->get_factor(), 1.0f)) {
 					// Handle high-precision (analog) scrolling.
 					zoom_widget->set_zoom(zoom * ((zoom_widget->get_zoom() / zoom - 1.f) * b->get_factor() + 1.f));
@@ -1173,16 +1173,16 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
 
 		if (!panning) {
 			if (b->is_pressed() &&
-					(b->get_button_index() == MOUSE_BUTTON_MIDDLE ||
-							(b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_PAN) ||
-							(b->get_button_index() == MOUSE_BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) {
+					(b->get_button_index() == MouseButton::MIDDLE ||
+							(b->get_button_index() == MouseButton::LEFT && tool == TOOL_PAN) ||
+							(b->get_button_index() == MouseButton::LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) {
 				// Pan the viewport
 				panning = true;
 			}
 		}
 
 		if (panning) {
-			if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != MOUSE_BUTTON_WHEEL_DOWN && b->get_button_index() != MOUSE_BUTTON_WHEEL_UP))) {
+			if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != MouseButton::WHEEL_DOWN && b->get_button_index() != MouseButton::WHEEL_UP))) {
 				// Stop panning the viewport (for any mouse button press except zooming)
 				panning = false;
 			}
@@ -1294,8 +1294,8 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
 
 	// Drag the pivot (in pivot mode / with V key)
 	if (drag_type == DRAG_NONE) {
-		if ((b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
-				(k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_V && tool == TOOL_SELECT && k->get_modifiers_mask() == 0)) {
+		if ((b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::LEFT && tool == TOOL_EDIT_PIVOT) ||
+				(k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == Key::V && tool == TOOL_SELECT && k->get_modifiers_mask() == Key::NONE)) {
 			List<CanvasItem *> selection = _get_edited_canvas_items();
 
 			// Filters the selection with nodes that allow setting the pivot
@@ -1345,8 +1345,8 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
 
 		// Confirm the pivot move
 		if (drag_selection.size() >= 1 &&
-				((b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
-						(k.is_valid() && !k->is_pressed() && k->get_keycode() == KEY_V))) {
+				((b.is_valid() && !b->is_pressed() && b->get_button_index() == MouseButton::LEFT && tool == TOOL_EDIT_PIVOT) ||
+						(k.is_valid() && !k->is_pressed() && k->get_keycode() == Key::V))) {
 			_commit_canvas_item_state(
 					drag_selection,
 					vformat(
@@ -1359,7 +1359,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
 		}
 
 		// Cancel a drag
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) {
 			_restore_canvas_item_state(drag_selection);
 			drag_type = DRAG_NONE;
 			viewport->update();
@@ -1375,7 +1375,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
 
 	// Start rotation
 	if (drag_type == DRAG_NONE) {
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed()) {
 			if ((b->is_command_pressed() && !b->is_alt_pressed() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
 				List<CanvasItem *> selection = _get_edited_canvas_items();
 
@@ -1418,7 +1418,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
 		}
 
 		// Confirms the node rotation
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
 			if (drag_selection.size() != 1) {
 				_commit_canvas_item_state(
 						drag_selection,
@@ -1442,7 +1442,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
 		}
 
 		// Cancel a drag
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) {
 			_restore_canvas_item_state(drag_selection);
 			drag_type = DRAG_NONE;
 			viewport->update();
@@ -1456,7 +1456,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven
 	Ref<InputEventMouseButton> b = p_event;
 
 	// Open a sub-scene on double-click
-	if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && b->is_double_click() && tool == TOOL_SELECT) {
+	if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && b->is_double_click() && tool == TOOL_SELECT) {
 		List<CanvasItem *> selection = _get_edited_canvas_items();
 		if (selection.size() == 1) {
 			CanvasItem *canvas_item = selection[0];
@@ -1475,7 +1475,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
 
 	// Starts anchor dragging if needed
 	if (drag_type == DRAG_NONE) {
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT) {
 			List<CanvasItem *> selection = _get_edited_canvas_items();
 			if (selection.size() == 1) {
 				Control *control = Object::cast_to<Control>(selection[0]);
@@ -1595,7 +1595,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
 		}
 
 		// Confirms new anchor position
-		if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
+		if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
 			_commit_canvas_item_state(
 					drag_selection,
 					vformat(TTR("Move CanvasItem \"%s\" Anchor"), drag_selection[0]->get_name()));
@@ -1604,7 +1604,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
 		}
 
 		// Cancel a drag
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) {
 			_restore_canvas_item_state(drag_selection);
 			drag_type = DRAG_NONE;
 			viewport->update();
@@ -1620,7 +1620,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
 
 	// Drag resize handles
 	if (drag_type == DRAG_NONE) {
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT) {
 			List<CanvasItem *> selection = _get_edited_canvas_items();
 			if (selection.size() == 1) {
 				CanvasItem *canvas_item = selection[0];
@@ -1774,7 +1774,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
 		}
 
 		// Confirm resize
-		if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
+		if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
 			const Node2D *node2d = Object::cast_to<Node2D>(drag_selection[0]);
 			if (node2d) {
 				// Extends from Node2D.
@@ -1811,7 +1811,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
 		}
 
 		// Cancel a drag
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) {
 			_restore_canvas_item_state(drag_selection);
 			snap_target[0] = SNAP_TARGET_NONE;
 			snap_target[1] = SNAP_TARGET_NONE;
@@ -1829,7 +1829,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
 
 	// Drag resize handles
 	if (drag_type == DRAG_NONE) {
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && ((b->is_alt_pressed() && b->is_ctrl_pressed()) || tool == TOOL_SCALE)) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && ((b->is_alt_pressed() && b->is_ctrl_pressed()) || tool == TOOL_SCALE)) {
 			List<CanvasItem *> selection = _get_edited_canvas_items();
 			if (selection.size() == 1) {
 				CanvasItem *canvas_item = selection[0];
@@ -1876,7 +1876,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
 			Transform2D simple_xform = (viewport->get_transform() * unscaled_transform).affine_inverse() * transform;
 
 			bool uniform = m->is_shift_pressed();
-			bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+			bool is_ctrl = Input::get_singleton()->is_key_pressed(Key::CTRL);
 
 			Point2 drag_from_local = simple_xform.xform(drag_from);
 			Point2 drag_to_local = simple_xform.xform(drag_to);
@@ -1925,7 +1925,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
 		}
 
 		// Confirm resize
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && !b->is_pressed()) {
 			if (drag_selection.size() != 1) {
 				_commit_canvas_item_state(
 						drag_selection,
@@ -1950,7 +1950,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
 		}
 
 		// Cancel a drag
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) {
 			_restore_canvas_item_state(drag_selection);
 			drag_type = DRAG_NONE;
 			viewport->update();
@@ -1967,7 +1967,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 
 	if (drag_type == DRAG_NONE) {
 		//Start moving the nodes
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed()) {
 			if ((b->is_alt_pressed() && !b->is_ctrl_pressed()) || tool == TOOL_MOVE) {
 				List<CanvasItem *> selection = _get_edited_canvas_items();
 
@@ -2050,7 +2050,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 		}
 
 		// Confirm the move (only if it was moved)
-		if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MouseButton::LEFT) {
 			if (transform.affine_inverse().xform(b->get_position()) != drag_from) {
 				if (drag_selection.size() != 1) {
 					_commit_canvas_item_state(
@@ -2083,7 +2083,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 		}
 
 		// Cancel a drag
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::RIGHT && b->is_pressed()) {
 			_restore_canvas_item_state(drag_selection, true);
 			snap_target[0] = SNAP_TARGET_NONE;
 			snap_target[1] = SNAP_TARGET_NONE;
@@ -2095,7 +2095,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 
 	// Move the canvas items with the arrow keys
 	if (k.is_valid() && k->is_pressed() && (tool == TOOL_SELECT || tool == TOOL_MOVE) &&
-			(k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_LEFT || k->get_keycode() == KEY_RIGHT)) {
+			(k->get_keycode() == Key::UP || k->get_keycode() == Key::DOWN || k->get_keycode() == Key::LEFT || k->get_keycode() == Key::RIGHT)) {
 		if (!k->is_echo()) {
 			// Start moving the canvas items with the keyboard
 			drag_selection = _get_edited_canvas_items();
@@ -2112,13 +2112,13 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 			bool move_local_base_rotated = k->is_ctrl_pressed() || k->is_meta_pressed();
 
 			Vector2 dir;
-			if (k->get_keycode() == KEY_UP) {
+			if (k->get_keycode() == Key::UP) {
 				dir += Vector2(0, -1);
-			} else if (k->get_keycode() == KEY_DOWN) {
+			} else if (k->get_keycode() == Key::DOWN) {
 				dir += Vector2(0, 1);
-			} else if (k->get_keycode() == KEY_LEFT) {
+			} else if (k->get_keycode() == Key::LEFT) {
 				dir += Vector2(-1, 0);
-			} else if (k->get_keycode() == KEY_RIGHT) {
+			} else if (k->get_keycode() == Key::RIGHT) {
 				dir += Vector2(1, 0);
 			}
 			if (k->is_shift_pressed()) {
@@ -2166,12 +2166,12 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 	}
 
 	if (k.is_valid() && !k->is_pressed() && drag_type == DRAG_KEY_MOVE && (tool == TOOL_SELECT || tool == TOOL_MOVE) &&
-			(k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_LEFT || k->get_keycode() == KEY_RIGHT)) {
+			(k->get_keycode() == Key::UP || k->get_keycode() == Key::DOWN || k->get_keycode() == Key::LEFT || k->get_keycode() == Key::RIGHT)) {
 		// Confirm canvas items move by arrow keys
-		if ((!Input::get_singleton()->is_key_pressed(KEY_UP)) &&
-				(!Input::get_singleton()->is_key_pressed(KEY_DOWN)) &&
-				(!Input::get_singleton()->is_key_pressed(KEY_LEFT)) &&
-				(!Input::get_singleton()->is_key_pressed(KEY_RIGHT))) {
+		if ((!Input::get_singleton()->is_key_pressed(Key::UP)) &&
+				(!Input::get_singleton()->is_key_pressed(Key::DOWN)) &&
+				(!Input::get_singleton()->is_key_pressed(Key::LEFT)) &&
+				(!Input::get_singleton()->is_key_pressed(Key::RIGHT))) {
 			if (drag_selection.size() > 1) {
 				_commit_canvas_item_state(
 						drag_selection,
@@ -2192,7 +2192,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
 		return true;
 	}
 
-	return (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_LEFT || k->get_keycode() == KEY_RIGHT)); // Accept the key event in any case
+	return (k.is_valid() && (k->get_keycode() == Key::UP || k->get_keycode() == Key::DOWN || k->get_keycode() == Key::LEFT || k->get_keycode() == Key::RIGHT)); // Accept the key event in any case
 }
 
 bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
@@ -2202,8 +2202,8 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 
 	if (drag_type == DRAG_NONE) {
 		if (b.is_valid() &&
-				((b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_alt_pressed() && tool == TOOL_SELECT) ||
-						(b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_LIST_SELECT))) {
+				((b->get_button_index() == MouseButton::RIGHT && b->is_alt_pressed() && tool == TOOL_SELECT) ||
+						(b->get_button_index() == MouseButton::LEFT && tool == TOOL_LIST_SELECT))) {
 			// Popup the selection menu list
 			Point2 click = transform.affine_inverse().xform(b->get_position());
 
@@ -2264,7 +2264,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 			}
 		}
 
-		if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) {
 			add_node_menu->set_size(Vector2(1, 1));
 			add_node_menu->set_position(get_screen_position() + b->get_position());
 			add_node_menu->popup();
@@ -2272,7 +2272,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 			return true;
 		}
 
-		if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
+		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT) {
 			// Single item selection
 			Point2 click = transform.affine_inverse().xform(b->get_position());
 
@@ -2348,7 +2348,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 	}
 
 	if (drag_type == DRAG_BOX_SELECTION) {
-		if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MouseButton::LEFT) {
 			// Confirms box selection
 			Node *scene = editor->get_edited_scene();
 			if (scene) {
@@ -2377,7 +2377,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 			return true;
 		}
 
-		if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) {
 			// Cancel box selection
 			drag_type = DRAG_NONE;
 			viewport->update();
@@ -2392,7 +2392,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_ESCAPE && drag_type == DRAG_NONE && tool == TOOL_SELECT) {
+	if (k.is_valid() && k->is_pressed() && k->get_keycode() == Key::ESCAPE && drag_type == DRAG_NONE && tool == TOOL_SELECT) {
 		// Unselect everything
 		editor_selection->clear();
 		viewport->update();
@@ -2414,7 +2414,7 @@ bool CanvasItemEditor::_gui_input_ruler_tool(const Ref<InputEvent> &p_event) {
 		ruler_tool_origin = snap_point(viewport->get_local_mouse_position() / zoom + view_offset);
 	}
 
-	if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (b.is_valid() && b->get_button_index() == MouseButton::LEFT) {
 		if (b->is_pressed()) {
 			ruler_tool_active = true;
 		} else {
@@ -3354,8 +3354,8 @@ void CanvasItemEditor::_draw_selection() {
 			}
 
 			// Draw the move handles
-			bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL);
-			bool is_alt = Input::get_singleton()->is_key_pressed(KEY_ALT);
+			bool is_ctrl = Input::get_singleton()->is_key_pressed(Key::CTRL);
+			bool is_alt = Input::get_singleton()->is_key_pressed(Key::ALT);
 			if (tool == TOOL_MOVE && show_transformation_gizmos) {
 				if (_is_node_movable(canvas_item)) {
 					Transform2D unscaled_transform = (xform * canvas_item->get_transform().affine_inverse() * canvas_item->_edit_get_transform()).orthonormalized();
@@ -3391,7 +3391,7 @@ void CanvasItemEditor::_draw_selection() {
 					Transform2D simple_xform = viewport->get_transform() * unscaled_transform;
 
 					Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE, SCALE_HANDLE_DISTANCE);
-					bool uniform = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
+					bool uniform = Input::get_singleton()->is_key_pressed(Key::SHIFT);
 					Point2 offset = (simple_xform.affine_inverse().xform(drag_to) - simple_xform.affine_inverse().xform(drag_from)) * zoom;
 
 					if (drag_type == DRAG_SCALE_X) {
@@ -5330,9 +5330,9 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	select_button->set_toggle_mode(true);
 	select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SELECT));
 	select_button->set_pressed(true);
-	select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), KEY_Q));
+	select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), Key::Q));
 	select_button->set_shortcut_context(this);
-	select_button->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("RMB: Add node at position clicked."));
+	select_button->set_tooltip(keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("RMB: Add node at position clicked."));
 
 	hb->add_child(memnew(VSeparator));
 
@@ -5341,7 +5341,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	hb->add_child(move_button);
 	move_button->set_toggle_mode(true);
 	move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_MOVE));
-	move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
+	move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), Key::W));
 	move_button->set_shortcut_context(this);
 	move_button->set_tooltip(TTR("Move Mode"));
 
@@ -5350,7 +5350,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	hb->add_child(rotate_button);
 	rotate_button->set_toggle_mode(true);
 	rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_ROTATE));
-	rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
+	rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), Key::E));
 	rotate_button->set_shortcut_context(this);
 	rotate_button->set_tooltip(TTR("Rotate Mode"));
 
@@ -5359,7 +5359,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	hb->add_child(scale_button);
 	scale_button->set_toggle_mode(true);
 	scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_SCALE));
-	scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
+	scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), Key::S));
 	scale_button->set_shortcut_context(this);
 	scale_button->set_tooltip(TTR("Scale Mode"));
 
@@ -5384,7 +5384,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	hb->add_child(pan_button);
 	pan_button->set_toggle_mode(true);
 	pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_PAN));
-	pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), KEY_G));
+	pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), Key::G));
 	pan_button->set_shortcut_context(this);
 	pan_button->set_tooltip(TTR("You can also use Pan View shortcut (Space by default) to pan in any mode."));
 
@@ -5393,7 +5393,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	hb->add_child(ruler_button);
 	ruler_button->set_toggle_mode(true);
 	ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select), make_binds(TOOL_RULER));
-	ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), KEY_R));
+	ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), Key::R));
 	ruler_button->set_shortcut_context(this);
 	ruler_button->set_tooltip(TTR("Ruler Mode"));
 
@@ -5405,7 +5405,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	smart_snap_button->set_toggle_mode(true);
 	smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap));
 	smart_snap_button->set_tooltip(TTR("Toggle smart snapping."));
-	smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KEY_MASK_SHIFT | KEY_S));
+	smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KeyModifierMask::SHIFT | Key::S));
 	smart_snap_button->set_shortcut_context(this);
 
 	grid_snap_button = memnew(Button);
@@ -5414,7 +5414,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	grid_snap_button->set_toggle_mode(true);
 	grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap));
 	grid_snap_button->set_tooltip(TTR("Toggle grid snapping."));
-	grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KEY_MASK_SHIFT | KEY_G));
+	grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KeyModifierMask::SHIFT | Key::G));
 	grid_snap_button->set_shortcut_context(this);
 
 	snap_config_menu = memnew(MenuButton);
@@ -5457,7 +5457,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	lock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(LOCK_SELECTED));
 	lock_button->set_tooltip(TTR("Lock selected node, preventing selection and movement."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
+	lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KeyModifierMask::CMD | Key::L));
 
 	unlock_button = memnew(Button);
 	unlock_button->set_flat(true);
@@ -5465,7 +5465,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	unlock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(UNLOCK_SELECTED));
 	unlock_button->set_tooltip(TTR("Unlock selected node, allowing selection and movement."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
+	unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::L));
 
 	group_button = memnew(Button);
 	group_button->set_flat(true);
@@ -5473,7 +5473,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	group_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(GROUP_SELECTED));
 	group_button->set_tooltip(TTR("Makes sure the object's children are not selectable."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
+	group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD | Key::G));
 
 	ungroup_button = memnew(Button);
 	ungroup_button->set_flat(true);
@@ -5481,7 +5481,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	ungroup_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(UNGROUP_SELECTED));
 	ungroup_button->set_tooltip(TTR("Restores the object's children's ability to be selected."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
+	ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::G));
 
 	hb->add_child(memnew(VSeparator));
 
@@ -5495,7 +5495,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	p->set_hide_on_checkable_item_selection(false);
 	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_show_bones", TTR("Show Bones")), SKELETON_SHOW_BONES);
 	p->add_separator();
-	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bone2D Node(s) from Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B), SKELETON_MAKE_BONES);
+	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bone2D Node(s) from Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::B), SKELETON_MAKE_BONES);
 	p->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback));
 
 	hb->add_child(memnew(VSeparator));
@@ -5519,21 +5519,21 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 
 	p = view_menu->get_popup();
 	p->set_hide_on_checkable_item_selection(false);
-	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Always Show Grid"), KEY_NUMBERSIGN), SHOW_GRID);
-	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), KEY_H), SHOW_HELPERS);
+	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Always Show Grid"), Key::NUMBERSIGN), SHOW_GRID);
+	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_helpers", TTR("Show Helpers"), Key::H), SHOW_HELPERS);
 	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_rulers", TTR("Show Rulers")), SHOW_RULERS);
-	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), KEY_Y), SHOW_GUIDES);
+	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), Key::Y), SHOW_GUIDES);
 	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_origin", TTR("Show Origin")), SHOW_ORIGIN);
 	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_viewport", TTR("Show Viewport")), SHOW_VIEWPORT);
 	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_edit_locks", TTR("Show Group And Lock Icons")), SHOW_EDIT_LOCKS);
 	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_transformation_gizmos", TTR("Show Transformation Gizmos")), SHOW_TRANSFORMATION_GIZMOS);
 
 	p->add_separator();
-	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION);
-	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION);
+	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), Key::F), VIEW_CENTER_TO_SELECTION);
+	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KeyModifierMask::SHIFT | Key::F), VIEW_FRAME_TO_SELECTION);
 	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/clear_guides", TTR("Clear Guides")), CLEAR_GUIDES);
 	p->add_separator();
-	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_P), PREVIEW_CANVAS_SCALE);
+	p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KeyModifierMask::SHIFT | KeyModifierMask::CMD | Key::P), PREVIEW_CANVAS_SCALE);
 
 	hb->add_child(memnew(VSeparator));
 
@@ -5604,7 +5604,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	key_insert_button->set_focus_mode(FOCUS_NONE);
 	key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_KEY));
 	key_insert_button->set_tooltip(TTR("Insert keys (based on mask)."));
-	key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT));
+	key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), Key::INSERT));
 	key_insert_button->set_shortcut_context(this);
 	animation_hb->add_child(key_insert_button);
 
@@ -5627,11 +5627,11 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	p = animation_menu->get_popup();
 
 	p->add_shortcut(ED_GET_SHORTCUT("canvas_item_editor/anim_insert_key"), ANIM_INSERT_KEY);
-	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key_existing_tracks", TTR("Insert Key (Existing Tracks)"), KEY_MASK_CMD + KEY_INSERT), ANIM_INSERT_KEY_EXISTING);
+	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key_existing_tracks", TTR("Insert Key (Existing Tracks)"), KeyModifierMask::CMD + Key::INSERT), ANIM_INSERT_KEY_EXISTING);
 	p->add_separator();
 	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_copy_pose", TTR("Copy Pose")), ANIM_COPY_POSE);
 	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_paste_pose", TTR("Paste Pose")), ANIM_PASTE_POSE);
-	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_clear_pose", TTR("Clear Pose"), KEY_MASK_SHIFT | KEY_K), ANIM_CLEAR_POSE);
+	p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_clear_pose", TTR("Clear Pose"), KeyModifierMask::SHIFT | Key::K), ANIM_CLEAR_POSE);
 
 	snap_dialog = memnew(SnapDialog);
 	snap_dialog->connect("confirmed", callable_mp(this, &CanvasItemEditor::_snap_changed));
@@ -5651,9 +5651,9 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	add_node_menu->add_icon_item(editor->get_scene_tree_dock()->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Instance Scene Here"));
 	add_node_menu->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_add_node_pressed));
 
-	multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), KEY_KP_MULTIPLY);
-	divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), KEY_KP_DIVIDE);
-	pan_view_shortcut = ED_SHORTCUT("canvas_item_editor/pan_view", TTR("Pan View"), KEY_SPACE);
+	multiply_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/multiply_grid_step", TTR("Multiply grid step by 2"), Key::KP_MULTIPLY);
+	divide_grid_step_shortcut = ED_SHORTCUT("canvas_item_editor/divide_grid_step", TTR("Divide grid step by 2"), Key::KP_DIVIDE);
+	pan_view_shortcut = ED_SHORTCUT("canvas_item_editor/pan_view", TTR("Pan View"), Key::SPACE);
 
 	skeleton_menu->get_popup()->set_item_checked(skeleton_menu->get_popup()->get_item_index(SKELETON_SHOW_BONES), true);
 	singleton = this;
@@ -5662,16 +5662,16 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	// those shortcuts one by one.
 	// Resetting zoom to 100% is a duplicate shortcut of `canvas_item_editor/reset_zoom`,
 	// but it ensures both 1 and Ctrl + 0 can be used to reset zoom.
-	ED_SHORTCUT("canvas_item_editor/zoom_3.125_percent", TTR("Zoom to 3.125%"), KEY_MASK_SHIFT | KEY_5);
-	ED_SHORTCUT("canvas_item_editor/zoom_6.25_percent", TTR("Zoom to 6.25%"), KEY_MASK_SHIFT | KEY_4);
-	ED_SHORTCUT("canvas_item_editor/zoom_12.5_percent", TTR("Zoom to 12.5%"), KEY_MASK_SHIFT | KEY_3);
-	ED_SHORTCUT("canvas_item_editor/zoom_25_percent", TTR("Zoom to 25%"), KEY_MASK_SHIFT | KEY_2);
-	ED_SHORTCUT("canvas_item_editor/zoom_50_percent", TTR("Zoom to 50%"), KEY_MASK_SHIFT | KEY_1);
-	ED_SHORTCUT("canvas_item_editor/zoom_100_percent", TTR("Zoom to 100%"), KEY_1);
-	ED_SHORTCUT("canvas_item_editor/zoom_200_percent", TTR("Zoom to 200%"), KEY_2);
-	ED_SHORTCUT("canvas_item_editor/zoom_400_percent", TTR("Zoom to 400%"), KEY_3);
-	ED_SHORTCUT("canvas_item_editor/zoom_800_percent", TTR("Zoom to 800%"), KEY_4);
-	ED_SHORTCUT("canvas_item_editor/zoom_1600_percent", TTR("Zoom to 1600%"), KEY_5);
+	ED_SHORTCUT("canvas_item_editor/zoom_3.125_percent", TTR("Zoom to 3.125%"), KeyModifierMask::SHIFT | Key::KEY_5);
+	ED_SHORTCUT("canvas_item_editor/zoom_6.25_percent", TTR("Zoom to 6.25%"), KeyModifierMask::SHIFT | Key::KEY_4);
+	ED_SHORTCUT("canvas_item_editor/zoom_12.5_percent", TTR("Zoom to 12.5%"), KeyModifierMask::SHIFT | Key::KEY_3);
+	ED_SHORTCUT("canvas_item_editor/zoom_25_percent", TTR("Zoom to 25%"), KeyModifierMask::SHIFT | Key::KEY_2);
+	ED_SHORTCUT("canvas_item_editor/zoom_50_percent", TTR("Zoom to 50%"), KeyModifierMask::SHIFT | Key::KEY_1);
+	ED_SHORTCUT("canvas_item_editor/zoom_100_percent", TTR("Zoom to 100%"), Key::KEY_1);
+	ED_SHORTCUT("canvas_item_editor/zoom_200_percent", TTR("Zoom to 200%"), Key::KEY_2);
+	ED_SHORTCUT("canvas_item_editor/zoom_400_percent", TTR("Zoom to 400%"), Key::KEY_3);
+	ED_SHORTCUT("canvas_item_editor/zoom_800_percent", TTR("Zoom to 800%"), Key::KEY_4);
+	ED_SHORTCUT("canvas_item_editor/zoom_1600_percent", TTR("Zoom to 1600%"), Key::KEY_5);
 
 	set_process_unhandled_key_input(true);
 
@@ -6059,9 +6059,9 @@ bool CanvasItemEditorViewport::_only_packed_scenes_selected() const {
 }
 
 void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p_data) {
-	bool is_shift = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
-	bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL);
-	bool is_alt = Input::get_singleton()->is_key_pressed(KEY_ALT);
+	bool is_shift = Input::get_singleton()->is_key_pressed(Key::SHIFT);
+	bool is_ctrl = Input::get_singleton()->is_key_pressed(Key::CTRL);
+	bool is_alt = Input::get_singleton()->is_key_pressed(Key::ALT);
 
 	selected_files.clear();
 	Dictionary d = p_data;

+ 6 - 6
editor/plugins/collision_polygon_3d_editor_plugin.cpp

@@ -142,7 +142,7 @@ EditorPlugin::AfterGUIInput CollisionPolygon3DEditor::forward_spatial_gui_input(
 
 		switch (mode) {
 			case MODE_CREATE: {
-				if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
+				if (mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) {
 					if (!wip_active) {
 						wip.clear();
 						wip.push_back(cpoint);
@@ -166,14 +166,14 @@ EditorPlugin::AfterGUIInput CollisionPolygon3DEditor::forward_spatial_gui_input(
 							return EditorPlugin::AFTER_GUI_INPUT_STOP;
 						}
 					}
-				} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) {
+				} else if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed() && wip_active) {
 					_wip_close();
 				}
 
 			} break;
 
 			case MODE_EDIT: {
-				if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+				if (mb->get_button_index() == MouseButton::LEFT) {
 					if (mb->is_pressed()) {
 						if (mb->is_ctrl_pressed()) {
 							if (poly.size() < 3) {
@@ -267,7 +267,7 @@ EditorPlugin::AfterGUIInput CollisionPolygon3DEditor::forward_spatial_gui_input(
 						}
 					}
 				}
-				if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
+				if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed() && edited_point == -1) {
 					int closest_idx = -1;
 					Vector2 closest_pos;
 					real_t closest_dist = 1e10;
@@ -301,7 +301,7 @@ EditorPlugin::AfterGUIInput CollisionPolygon3DEditor::forward_spatial_gui_input(
 	Ref<InputEventMouseMotion> mm = p_event;
 
 	if (mm.is_valid()) {
-		if (edited_point != -1 && (wip_active || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT)) {
+		if (edited_point != -1 && (wip_active || (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE)) {
 			Vector2 gpoint = mm->get_position();
 
 			Vector3 ray_from = p_camera->project_ray_origin(gpoint);
@@ -317,7 +317,7 @@ EditorPlugin::AfterGUIInput CollisionPolygon3DEditor::forward_spatial_gui_input(
 
 			Vector2 cpoint(spoint.x, spoint.y);
 
-			if (snap_ignore && !Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+			if (snap_ignore && !Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 				snap_ignore = false;
 			}
 

+ 3 - 3
editor/plugins/collision_shape_2d_editor_plugin.cpp

@@ -183,7 +183,7 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
 					size.y = p_point.y * RECT_HANDLES[idx].y * 2;
 				}
 
-				if (Input::get_singleton()->is_key_pressed(KEY_ALT)) {
+				if (Input::get_singleton()->is_key_pressed(Key::ALT)) {
 					rect->set_size(size.abs());
 					node->set_global_position(original_transform.get_origin());
 				} else {
@@ -333,7 +333,7 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
 	if (mb.is_valid()) {
 		Vector2 gpoint = mb->get_position();
 
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				for (int i = 0; i < handles.size(); i++) {
 					if (xform.xform(handles[i]).distance_to(gpoint) < 8) {
@@ -394,7 +394,7 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
 			return false;
 		}
 
-		if (shape_type == RECTANGLE_SHAPE && k->get_keycode() == KEY_ALT) {
+		if (shape_type == RECTANGLE_SHAPE && k->get_keycode() == Key::ALT) {
 			set_handle(edit_handle, last_point); // Update handle when Alt key is toggled.
 		}
 	}

+ 6 - 6
editor/plugins/curve_editor_plugin.cpp

@@ -115,16 +115,16 @@ void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
 			}
 
 			switch (mb.get_button_index()) {
-				case MOUSE_BUTTON_RIGHT:
+				case MouseButton::RIGHT:
 					_context_click_pos = mpos;
 					open_context_menu(get_global_transform().xform(mpos));
 					break;
 
-				case MOUSE_BUTTON_MIDDLE:
+				case MouseButton::MIDDLE:
 					remove_point(_hover_point);
 					break;
 
-				case MOUSE_BUTTON_LEFT:
+				case MouseButton::LEFT:
 					_dragging = true;
 					break;
 				default:
@@ -132,7 +132,7 @@ void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
 			}
 		}
 
-		if (!mb.is_pressed() && _dragging && mb.get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (!mb.is_pressed() && _dragging && mb.get_button_index() == MouseButton::LEFT) {
 			_dragging = false;
 			if (_has_undo_data) {
 				UndoRedo &ur = *EditorNode::get_singleton()->get_undo_redo();
@@ -210,7 +210,7 @@ void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
 						tangent = 9999 * (dir.y >= 0 ? 1 : -1);
 					}
 
-					bool link = !Input::get_singleton()->is_key_pressed(KEY_SHIFT);
+					bool link = !Input::get_singleton()->is_key_pressed(Key::SHIFT);
 
 					if (_selected_tangent == TANGENT_LEFT) {
 						curve.set_point_left_tangent(_selected_point, tangent);
@@ -240,7 +240,7 @@ void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
 		const InputEventKey &key = **key_ref;
 
 		if (key.is_pressed() && _selected_point != -1) {
-			if (key.get_keycode() == KEY_DELETE) {
+			if (key.get_keycode() == Key::KEY_DELETE) {
 				remove_point(_selected_point);
 			}
 		}

+ 3 - 3
editor/plugins/debugger_editor_plugin.cpp

@@ -41,10 +41,10 @@
 DebuggerEditorPlugin::DebuggerEditorPlugin(EditorNode *p_editor, MenuButton *p_debug_menu) {
 	EditorDebuggerServer::initialize();
 
-	ED_SHORTCUT("debugger/step_into", TTR("Step Into"), KEY_F11);
-	ED_SHORTCUT("debugger/step_over", TTR("Step Over"), KEY_F10);
+	ED_SHORTCUT("debugger/step_into", TTR("Step Into"), Key::F11);
+	ED_SHORTCUT("debugger/step_over", TTR("Step Over"), Key::F10);
 	ED_SHORTCUT("debugger/break", TTR("Break"));
-	ED_SHORTCUT("debugger/continue", TTR("Continue"), KEY_F12);
+	ED_SHORTCUT("debugger/continue", TTR("Continue"), Key::F12);
 	ED_SHORTCUT("debugger/keep_debugger_open", TTR("Keep Debugger Open"));
 	ED_SHORTCUT("debugger/debug_with_external_editor", TTR("Debug with External Editor"));
 

+ 1 - 1
editor/plugins/mesh_editor_plugin.cpp

@@ -36,7 +36,7 @@ void MeshEditor::gui_input(const Ref<InputEvent> &p_event) {
 	ERR_FAIL_COND(p_event.is_null());
 
 	Ref<InputEventMouseMotion> mm = p_event;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		rot_x -= mm->get_relative().y * 0.01;
 		rot_y -= mm->get_relative().x * 0.01;
 		if (rot_x < -Math_PI / 2) {

+ 96 - 96
editor/plugins/node_3d_editor_plugin.cpp

@@ -185,7 +185,7 @@ void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) {
 	ERR_FAIL_COND(p_event.is_null());
 
 	const Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		Vector2 pos = mb->get_position();
 		if (mb->is_pressed()) {
 			if (pos.distance_to(get_size() / 2.0) < get_size().x / 2.0) {
@@ -901,36 +901,36 @@ void Node3DEditorViewport::_compute_edit(const Point2 &p_point) {
 	}
 }
 
-static int _get_key_modifier_setting(const String &p_property) {
+static Key _get_key_modifier_setting(const String &p_property) {
 	switch (EditorSettings::get_singleton()->get(p_property).operator int()) {
 		case 0:
-			return 0;
+			return Key::NONE;
 		case 1:
-			return KEY_SHIFT;
+			return Key::SHIFT;
 		case 2:
-			return KEY_ALT;
+			return Key::ALT;
 		case 3:
-			return KEY_META;
+			return Key::META;
 		case 4:
-			return KEY_CTRL;
+			return Key::CTRL;
 	}
-	return 0;
+	return Key::NONE;
 }
 
-static int _get_key_modifier(Ref<InputEventWithModifiers> e) {
+static Key _get_key_modifier(Ref<InputEventWithModifiers> e) {
 	if (e->is_shift_pressed()) {
-		return KEY_SHIFT;
+		return Key::SHIFT;
 	}
 	if (e->is_alt_pressed()) {
-		return KEY_ALT;
+		return Key::ALT;
 	}
 	if (e->is_ctrl_pressed()) {
-		return KEY_CTRL;
+		return Key::CTRL;
 	}
 	if (e->is_meta_pressed()) {
-		return KEY_META;
+		return Key::META;
 	}
-	return 0;
+	return Key::NONE;
 }
 
 bool Node3DEditorViewport::_transform_gizmo_select(const Vector2 &p_screenpos, bool p_highlight_only) {
@@ -1336,7 +1336,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 
 		const real_t zoom_factor = 1 + (ZOOM_FREELOOK_MULTIPLIER - 1) * b->get_factor();
 		switch (b->get_button_index()) {
-			case MOUSE_BUTTON_WHEEL_UP: {
+			case MouseButton::WHEEL_UP: {
 				if (b->is_alt_pressed()) {
 					scale_fov(-0.05);
 				} else {
@@ -1347,7 +1347,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 					}
 				}
 			} break;
-			case MOUSE_BUTTON_WHEEL_DOWN: {
+			case MouseButton::WHEEL_DOWN: {
 				if (b->is_alt_pressed()) {
 					scale_fov(0.05);
 				} else {
@@ -1358,7 +1358,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 					}
 				}
 			} break;
-			case MOUSE_BUTTON_RIGHT: {
+			case MouseButton::RIGHT: {
 				NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
 
 				if (b->is_pressed() && _edit.gizmo.is_valid()) {
@@ -1415,7 +1415,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 				}
 
 				if (b->is_pressed()) {
-					const int mod = _get_key_modifier(b);
+					const Key mod = _get_key_modifier(b);
 					if (!orthogonal) {
 						if (mod == _get_key_modifier_setting("editors/3d/freelook/freelook_activation_modifier")) {
 							set_freelook_active(true);
@@ -1432,7 +1432,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 				}
 
 			} break;
-			case MOUSE_BUTTON_MIDDLE: {
+			case MouseButton::MIDDLE: {
 				if (b->is_pressed() && _edit.mode != TRANSFORM_NONE) {
 					switch (_edit.plane) {
 						case TRANSFORM_VIEW: {
@@ -1463,7 +1463,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 					}
 				}
 			} break;
-			case MOUSE_BUTTON_LEFT: {
+			case MouseButton::LEFT: {
 				if (b->is_pressed()) {
 					NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
 					if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->is_alt_pressed()) {
@@ -1724,7 +1724,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 			}
 		}
 
-		if (spatial_editor->get_current_hover_gizmo().is_null() && !(m->get_button_mask() & 1) && !_edit.gizmo.is_valid()) {
+		if (spatial_editor->get_current_hover_gizmo().is_null() && (m->get_button_mask() & MouseButton::MASK_LEFT) == MouseButton::NONE && !_edit.gizmo.is_valid()) {
 			_transform_gizmo_select(_edit.mouse_pos, true);
 		}
 
@@ -1737,7 +1737,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 			String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
 			set_message(n + ": " + String(v));
 
-		} else if (m->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+		} else if ((m->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 			if (nav_scheme == NAVIGATION_MAYA && m->is_alt_pressed()) {
 				nav_mode = NAVIGATION_ORBIT;
 			} else if (nav_scheme == NAVIGATION_MODO && m->is_alt_pressed() && m->is_shift_pressed()) {
@@ -1827,7 +1827,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 
 							} else {
 								// Alternative planar scaling mode
-								if (_get_key_modifier(m) != KEY_SHIFT) {
+								if (_get_key_modifier(m) != Key::SHIFT) {
 									motion = motion_mask.dot(motion) * motion_mask;
 								}
 							}
@@ -2082,7 +2082,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 					}
 				}
 			}
-		} else if ((m->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) || freelook_active) {
+		} else if ((m->get_button_mask() & MouseButton::MASK_RIGHT) != MouseButton::NONE || freelook_active) {
 			if (nav_scheme == NAVIGATION_MAYA && m->is_alt_pressed()) {
 				nav_mode = NAVIGATION_ZOOM;
 			} else if (freelook_active) {
@@ -2091,14 +2091,14 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 				nav_mode = NAVIGATION_PAN;
 			}
 
-		} else if (m->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
-			const int mod = _get_key_modifier(m);
+		} else if ((m->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) {
+			const Key mod = _get_key_modifier(m);
 			if (nav_scheme == NAVIGATION_GODOT) {
 				if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
 					nav_mode = NAVIGATION_PAN;
 				} else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) {
 					nav_mode = NAVIGATION_ZOOM;
-				} else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
+				} else if (mod == Key::ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
 					// Always allow Alt as a modifier to better support graphic tablets.
 					nav_mode = NAVIGATION_ORBIT;
 				}
@@ -2109,14 +2109,14 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 			}
 		} else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) {
 			// Handle trackpad (no external mouse) use case
-			const int mod = _get_key_modifier(m);
+			const Key mod = _get_key_modifier(m);
 
-			if (mod) {
+			if (mod != Key::NONE) {
 				if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
 					nav_mode = NAVIGATION_PAN;
 				} else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) {
 					nav_mode = NAVIGATION_ZOOM;
-				} else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
+				} else if (mod == Key::ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
 					// Always allow Alt as a modifier to better support graphic tablets.
 					nav_mode = NAVIGATION_ORBIT;
 				}
@@ -2164,13 +2164,13 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 		NavigationMode nav_mode = NAVIGATION_NONE;
 
 		if (nav_scheme == NAVIGATION_GODOT) {
-			const int mod = _get_key_modifier(pan_gesture);
+			const Key mod = _get_key_modifier(pan_gesture);
 
 			if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
 				nav_mode = NAVIGATION_PAN;
 			} else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) {
 				nav_mode = NAVIGATION_ZOOM;
-			} else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
+			} else if (mod == Key::ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) {
 				// Always allow Alt as a modifier to better support graphic tablets.
 				nav_mode = NAVIGATION_ORBIT;
 			}
@@ -2215,9 +2215,9 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 		}
 
 		if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_numpad")) {
-			const uint32_t code = k->get_keycode();
-			if (code >= KEY_0 && code <= KEY_9) {
-				k->set_keycode(code - KEY_0 + KEY_KP_0);
+			const Key code = k->get_keycode();
+			if (code >= Key::KEY_0 && code <= Key::KEY_9) {
+				k->set_keycode(code - Key::KEY_0 + Key::KP_0);
 			}
 		}
 
@@ -2316,11 +2316,11 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
 		if (!orthogonal && ED_IS_SHORTCUT("spatial_editor/freelook_toggle", p_event)) {
 			set_freelook_active(!is_freelook_active());
 
-		} else if (k->get_keycode() == KEY_ESCAPE) {
+		} else if (k->get_keycode() == Key::ESCAPE) {
 			set_freelook_active(false);
 		}
 
-		if (k->get_keycode() == KEY_SPACE) {
+		if (k->get_keycode() == Key::SPACE) {
 			if (!k->is_pressed()) {
 				emit_signal(SNAME("toggle_maximize_view"), this);
 			}
@@ -4198,8 +4198,8 @@ void Node3DEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p_
 		return;
 	}
 
-	bool is_shift = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
-	bool is_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+	bool is_shift = Input::get_singleton()->is_key_pressed(Key::SHIFT);
+	bool is_ctrl = Input::get_singleton()->is_key_pressed(Key::CTRL);
 
 	selected_files.clear();
 	Dictionary d = p_data;
@@ -4394,18 +4394,18 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
 		view_menu->get_popup()->set_item_tooltip(shadeless_idx, unsupported_tooltip);
 	}
 
-	ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), KEY_A);
-	ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), KEY_D);
-	ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), KEY_W);
-	ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), KEY_S);
-	ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), KEY_E);
-	ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), KEY_Q);
-	ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), KEY_SHIFT);
-	ED_SHORTCUT("spatial_editor/freelook_slow_modifier", TTR("Freelook Slow Modifier"), KEY_ALT);
+	ED_SHORTCUT("spatial_editor/freelook_left", TTR("Freelook Left"), Key::A);
+	ED_SHORTCUT("spatial_editor/freelook_right", TTR("Freelook Right"), Key::D);
+	ED_SHORTCUT("spatial_editor/freelook_forward", TTR("Freelook Forward"), Key::W);
+	ED_SHORTCUT("spatial_editor/freelook_backwards", TTR("Freelook Backwards"), Key::S);
+	ED_SHORTCUT("spatial_editor/freelook_up", TTR("Freelook Up"), Key::E);
+	ED_SHORTCUT("spatial_editor/freelook_down", TTR("Freelook Down"), Key::Q);
+	ED_SHORTCUT("spatial_editor/freelook_speed_modifier", TTR("Freelook Speed Modifier"), Key::SHIFT);
+	ED_SHORTCUT("spatial_editor/freelook_slow_modifier", TTR("Freelook Slow Modifier"), Key::ALT);
 
 	preview_camera = memnew(CheckBox);
 	preview_camera->set_text(TTR("Preview"));
-	preview_camera->set_shortcut(ED_SHORTCUT("spatial_editor/toggle_camera_preview", TTR("Toggle Camera Preview"), KEY_MASK_CMD | KEY_P));
+	preview_camera->set_shortcut(ED_SHORTCUT("spatial_editor/toggle_camera_preview", TTR("Toggle Camera Preview"), KeyModifierMask::CMD | Key::P));
 	vbox->add_child(preview_camera);
 	preview_camera->set_h_size_flags(0);
 	preview_camera->hide();
@@ -4519,7 +4519,7 @@ void Node3DEditorViewportContainer::gui_input(const Ref<InputEvent> &p_event) {
 
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_pressed()) {
 			Vector2 size = get_size();
 
@@ -6625,7 +6625,7 @@ void Node3DEditor::unhandled_key_input(const Ref<InputEvent> &p_event) {
 		return;
 	}
 
-	snap_key_enabled = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+	snap_key_enabled = Input::get_singleton()->is_key_pressed(Key::CTRL);
 }
 
 void Node3DEditor::_sun_environ_settings_pressed() {
@@ -6637,7 +6637,7 @@ void Node3DEditor::_sun_environ_settings_pressed() {
 void Node3DEditor::_add_sun_to_scene(bool p_already_added_environment) {
 	sun_environ_popup->hide();
 
-	if (!p_already_added_environment && world_env_count == 0 && Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (!p_already_added_environment && world_env_count == 0 && Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		// Prevent infinite feedback loop between the sun and environment methods.
 		_add_environment_to_scene(true);
 	}
@@ -6665,7 +6665,7 @@ void Node3DEditor::_add_sun_to_scene(bool p_already_added_environment) {
 void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) {
 	sun_environ_popup->hide();
 
-	if (!p_already_added_sun && directional_light_count == 0 && Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (!p_already_added_sun && directional_light_count == 0 && Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		// Prevent infinite feedback loop between the sun and environment methods.
 		_add_sun_to_scene(true);
 	}
@@ -7184,7 +7184,7 @@ void Node3DEditor::_update_preview_environment() {
 
 void Node3DEditor::_sun_direction_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseMotion> mm = p_event;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		sun_rotation.x += mm->get_relative().y * (0.02 * EDSCALE);
 		sun_rotation.y -= mm->get_relative().x * (0.02 * EDSCALE);
 		sun_rotation.x = CLAMP(sun_rotation.x, -Math_TAU / 4, Math_TAU / 4);
@@ -7241,9 +7241,9 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_MODE_SELECT]->set_pressed(true);
 	button_binds.write[0] = MENU_TOOL_SELECT;
 	tool_button[TOOL_MODE_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
-	tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), KEY_Q));
+	tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), Key::Q));
 	tool_button[TOOL_MODE_SELECT]->set_shortcut_context(this);
-	tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked."));
+	tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked."));
 	hbc_menu->add_child(memnew(VSeparator));
 
 	tool_button[TOOL_MODE_MOVE] = memnew(Button);
@@ -7252,7 +7252,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_MODE_MOVE]->set_flat(true);
 	button_binds.write[0] = MENU_TOOL_MOVE;
 	tool_button[TOOL_MODE_MOVE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
-	tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), KEY_W));
+	tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTR("Move Mode"), Key::W));
 	tool_button[TOOL_MODE_MOVE]->set_shortcut_context(this);
 
 	tool_button[TOOL_MODE_ROTATE] = memnew(Button);
@@ -7261,7 +7261,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_MODE_ROTATE]->set_flat(true);
 	button_binds.write[0] = MENU_TOOL_ROTATE;
 	tool_button[TOOL_MODE_ROTATE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
-	tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), KEY_E));
+	tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTR("Rotate Mode"), Key::E));
 	tool_button[TOOL_MODE_ROTATE]->set_shortcut_context(this);
 
 	tool_button[TOOL_MODE_SCALE] = memnew(Button);
@@ -7270,7 +7270,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_MODE_SCALE]->set_flat(true);
 	button_binds.write[0] = MENU_TOOL_SCALE;
 	tool_button[TOOL_MODE_SCALE]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
-	tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), KEY_R));
+	tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTR("Scale Mode"), Key::R));
 	tool_button[TOOL_MODE_SCALE]->set_shortcut_context(this);
 
 	hbc_menu->add_child(memnew(VSeparator));
@@ -7290,7 +7290,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_LOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
 	tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock selected node, preventing selection and movement."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KEY_MASK_CMD | KEY_L));
+	tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KeyModifierMask::CMD | Key::L));
 
 	tool_button[TOOL_UNLOCK_SELECTED] = memnew(Button);
 	hbc_menu->add_child(tool_button[TOOL_UNLOCK_SELECTED]);
@@ -7299,7 +7299,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
 	tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock selected node, allowing selection and movement."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_L));
+	tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::L));
 
 	tool_button[TOOL_GROUP_SELECTED] = memnew(Button);
 	hbc_menu->add_child(tool_button[TOOL_GROUP_SELECTED]);
@@ -7308,7 +7308,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_GROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
 	tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Makes sure the object's children are not selectable."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KEY_MASK_CMD | KEY_G));
+	tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD | Key::G));
 
 	tool_button[TOOL_UNGROUP_SELECTED] = memnew(Button);
 	hbc_menu->add_child(tool_button[TOOL_UNGROUP_SELECTED]);
@@ -7317,7 +7317,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed), button_binds);
 	tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Restores the object's children's ability to be selected."));
 	// Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused.
-	tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G));
+	tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::G));
 
 	hbc_menu->add_child(memnew(VSeparator));
 
@@ -7327,7 +7327,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_flat(true);
 	button_binds.write[0] = MENU_TOOL_LOCAL_COORDS;
 	tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds);
-	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), KEY_T));
+	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Use Local Space"), Key::T));
 	tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut_context(this);
 
 	tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button);
@@ -7336,7 +7336,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	tool_option_button[TOOL_OPT_USE_SNAP]->set_flat(true);
 	button_binds.write[0] = MENU_TOOL_USE_SNAP;
 	tool_option_button[TOOL_OPT_USE_SNAP]->connect("toggled", callable_mp(this, &Node3DEditor::_menu_item_toggled), button_binds);
-	tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), KEY_Y));
+	tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTR("Use Snap"), Key::Y));
 	tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this);
 
 	hbc_menu->add_child(memnew(VSeparator));
@@ -7382,27 +7382,27 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	preview_node = memnew(Node3D);
 	preview_bounds = AABB();
 
-	ED_SHORTCUT("spatial_editor/bottom_view", TTR("Bottom View"), KEY_MASK_ALT + KEY_KP_7);
-	ED_SHORTCUT("spatial_editor/top_view", TTR("Top View"), KEY_KP_7);
-	ED_SHORTCUT("spatial_editor/rear_view", TTR("Rear View"), KEY_MASK_ALT + KEY_KP_1);
-	ED_SHORTCUT("spatial_editor/front_view", TTR("Front View"), KEY_KP_1);
-	ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KEY_MASK_ALT + KEY_KP_3);
-	ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), KEY_KP_3);
-	ED_SHORTCUT("spatial_editor/orbit_view_down", TTR("Orbit View Down"), KEY_KP_2);
-	ED_SHORTCUT("spatial_editor/orbit_view_left", TTR("Orbit View Left"), KEY_KP_4);
-	ED_SHORTCUT("spatial_editor/orbit_view_right", TTR("Orbit View Right"), KEY_KP_6);
-	ED_SHORTCUT("spatial_editor/orbit_view_up", TTR("Orbit View Up"), KEY_KP_8);
-	ED_SHORTCUT("spatial_editor/orbit_view_180", TTR("Orbit View 180"), KEY_KP_9);
-	ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal View"), KEY_KP_5);
-	ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K);
-	ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), KEY_O);
-	ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F);
-	ED_SHORTCUT("spatial_editor/align_transform_with_view", TTR("Align Transform with View"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_M);
-	ED_SHORTCUT("spatial_editor/align_rotation_with_view", TTR("Align Rotation with View"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_F);
-	ED_SHORTCUT("spatial_editor/freelook_toggle", TTR("Toggle Freelook"), KEY_MASK_SHIFT + KEY_F);
-	ED_SHORTCUT("spatial_editor/decrease_fov", TTR("Decrease Field of View"), KEY_MASK_CMD + KEY_EQUAL); // Usually direct access key for `KEY_PLUS`.
-	ED_SHORTCUT("spatial_editor/increase_fov", TTR("Increase Field of View"), KEY_MASK_CMD + KEY_MINUS);
-	ED_SHORTCUT("spatial_editor/reset_fov", TTR("Reset Field of View to Default"), KEY_MASK_CMD + KEY_0);
+	ED_SHORTCUT("spatial_editor/bottom_view", TTR("Bottom View"), KeyModifierMask::ALT + Key::KP_7);
+	ED_SHORTCUT("spatial_editor/top_view", TTR("Top View"), Key::KP_7);
+	ED_SHORTCUT("spatial_editor/rear_view", TTR("Rear View"), KeyModifierMask::ALT + Key::KP_1);
+	ED_SHORTCUT("spatial_editor/front_view", TTR("Front View"), Key::KP_1);
+	ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KeyModifierMask::ALT + Key::KP_3);
+	ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), Key::KP_3);
+	ED_SHORTCUT("spatial_editor/orbit_view_down", TTR("Orbit View Down"), Key::KP_2);
+	ED_SHORTCUT("spatial_editor/orbit_view_left", TTR("Orbit View Left"), Key::KP_4);
+	ED_SHORTCUT("spatial_editor/orbit_view_right", TTR("Orbit View Right"), Key::KP_6);
+	ED_SHORTCUT("spatial_editor/orbit_view_up", TTR("Orbit View Up"), Key::KP_8);
+	ED_SHORTCUT("spatial_editor/orbit_view_180", TTR("Orbit View 180"), Key::KP_9);
+	ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal View"), Key::KP_5);
+	ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), Key::K);
+	ED_SHORTCUT("spatial_editor/focus_origin", TTR("Focus Origin"), Key::O);
+	ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), Key::F);
+	ED_SHORTCUT("spatial_editor/align_transform_with_view", TTR("Align Transform with View"), KeyModifierMask::ALT + KeyModifierMask::CMD + Key::M);
+	ED_SHORTCUT("spatial_editor/align_rotation_with_view", TTR("Align Rotation with View"), KeyModifierMask::ALT + KeyModifierMask::CMD + Key::F);
+	ED_SHORTCUT("spatial_editor/freelook_toggle", TTR("Toggle Freelook"), KeyModifierMask::SHIFT + Key::F);
+	ED_SHORTCUT("spatial_editor/decrease_fov", TTR("Decrease Field of View"), KeyModifierMask::CMD + Key::EQUAL); // Usually direct access key for `KEY_PLUS`.
+	ED_SHORTCUT("spatial_editor/increase_fov", TTR("Increase Field of View"), KeyModifierMask::CMD + Key::MINUS);
+	ED_SHORTCUT("spatial_editor/reset_fov", TTR("Reset Field of View to Default"), KeyModifierMask::CMD + Key::KEY_0);
 
 	PopupMenu *p;
 
@@ -7413,7 +7413,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	hbc_menu->add_child(transform_menu);
 
 	p = transform_menu->get_popup();
-	p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), KEY_PAGEDOWN), MENU_SNAP_TO_FLOOR);
+	p->add_shortcut(ED_SHORTCUT("spatial_editor/snap_to_floor", TTR("Snap Object to Floor"), Key::PAGEDOWN), MENU_SNAP_TO_FLOOR);
 	p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog...")), MENU_TRANSFORM_DIALOG);
 
 	p->add_separator();
@@ -7445,19 +7445,19 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
 	accept = memnew(AcceptDialog);
 	editor->get_gui_base()->add_child(accept);
 
-	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/1_viewport", TTR("1 Viewport"), KEY_MASK_CMD + KEY_1), MENU_VIEW_USE_1_VIEWPORT);
-	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports", TTR("2 Viewports"), KEY_MASK_CMD + KEY_2), MENU_VIEW_USE_2_VIEWPORTS);
-	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports_alt", TTR("2 Viewports (Alt)"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_2), MENU_VIEW_USE_2_VIEWPORTS_ALT);
-	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTR("3 Viewports"), KEY_MASK_CMD + KEY_3), MENU_VIEW_USE_3_VIEWPORTS);
-	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTR("3 Viewports (Alt)"), KEY_MASK_ALT + KEY_MASK_CMD + KEY_3), MENU_VIEW_USE_3_VIEWPORTS_ALT);
-	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTR("4 Viewports"), KEY_MASK_CMD + KEY_4), MENU_VIEW_USE_4_VIEWPORTS);
+	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/1_viewport", TTR("1 Viewport"), KeyModifierMask::CMD + Key::KEY_1), MENU_VIEW_USE_1_VIEWPORT);
+	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports", TTR("2 Viewports"), KeyModifierMask::CMD + Key::KEY_2), MENU_VIEW_USE_2_VIEWPORTS);
+	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports_alt", TTR("2 Viewports (Alt)"), KeyModifierMask::ALT + KeyModifierMask::CMD + Key::KEY_2), MENU_VIEW_USE_2_VIEWPORTS_ALT);
+	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTR("3 Viewports"), KeyModifierMask::CMD + Key::KEY_3), MENU_VIEW_USE_3_VIEWPORTS);
+	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTR("3 Viewports (Alt)"), KeyModifierMask::ALT + KeyModifierMask::CMD + Key::KEY_3), MENU_VIEW_USE_3_VIEWPORTS_ALT);
+	p->add_radio_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTR("4 Viewports"), KeyModifierMask::CMD + Key::KEY_4), MENU_VIEW_USE_4_VIEWPORTS);
 	p->add_separator();
 
 	p->add_submenu_item(TTR("Gizmos"), "GizmosMenu");
 
 	p->add_separator();
 	p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_origin", TTR("View Origin")), MENU_VIEW_ORIGIN);
-	p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid"), KEY_NUMBERSIGN), MENU_VIEW_GRID);
+	p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid"), Key::NUMBERSIGN), MENU_VIEW_GRID);
 
 	p->add_separator();
 	p->add_shortcut(ED_SHORTCUT("spatial_editor/settings", TTR("Settings...")), MENU_VIEW_CAMERA_SETTINGS);
@@ -7870,7 +7870,7 @@ bool Node3DEditor::is_gizmo_visible() const {
 
 double Node3DEditor::get_translate_snap() const {
 	double snap_value;
-	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		snap_value = snap_translate->get_text().to_float() / 10.0;
 	} else {
 		snap_value = snap_translate->get_text().to_float();
@@ -7881,7 +7881,7 @@ double Node3DEditor::get_translate_snap() const {
 
 double Node3DEditor::get_rotate_snap() const {
 	double snap_value;
-	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		snap_value = snap_rotate->get_text().to_float() / 3.0;
 	} else {
 		snap_value = snap_rotate->get_text().to_float();
@@ -7892,7 +7892,7 @@ double Node3DEditor::get_rotate_snap() const {
 
 double Node3DEditor::get_scale_snap() const {
 	double snap_value;
-	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		snap_value = snap_scale->get_text().to_float() / 2.0;
 	} else {
 		snap_value = snap_scale->get_text().to_float();

+ 6 - 6
editor/plugins/path_2d_editor_plugin.cpp

@@ -88,7 +88,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
 				real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_position(i) + curve->get_point_in(i)));
 
 				// Check for point movement start (for point + in/out controls).
-				if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+				if (mb->get_button_index() == MouseButton::LEFT) {
 					if (mode == MODE_EDIT && !mb->is_shift_pressed() && dist_to_p < grab_threshold) {
 						// Points can only be moved in edit mode.
 
@@ -118,7 +118,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
 				}
 
 				// Check for point deletion.
-				if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && mode == MODE_DELETE)) {
+				if ((mb->get_button_index() == MouseButton::RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == MouseButton::LEFT && mode == MODE_DELETE)) {
 					if (dist_to_p < grab_threshold) {
 						undo_redo->create_action(TTR("Remove Point from Curve"));
 						undo_redo->add_do_method(curve.ptr(), "remove_point", i);
@@ -149,7 +149,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
 		}
 
 		// Check for point creation.
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && ((mb->is_command_pressed() && mode == MODE_EDIT) || mode == MODE_CREATE)) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && ((mb->is_command_pressed() && mode == MODE_EDIT) || mode == MODE_CREATE)) {
 			Ref<Curve2D> curve = node->get_curve();
 
 			undo_redo->create_action(TTR("Add Point to Curve"));
@@ -170,7 +170,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
 		}
 
 		// Check for segment split.
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mode == MODE_EDIT && on_edge) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && mode == MODE_EDIT && on_edge) {
 			Vector2 gpoint2 = mb->get_position();
 			Ref<Curve2D> curve = node->get_curve();
 
@@ -207,7 +207,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
 		}
 
 		// Check for point movement completion.
-		if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && action != ACTION_NONE) {
+		if (!mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && action != ACTION_NONE) {
 			Ref<Curve2D> curve = node->get_curve();
 
 			Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
@@ -537,7 +537,7 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) {
 	curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons")));
 	curve_edit->set_toggle_mode(true);
 	curve_edit->set_focus_mode(Control::FOCUS_NONE);
-	curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point"));
+	curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point"));
 	curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected), varray(MODE_EDIT));
 	base_hb->add_child(curve_edit);
 	curve_edit_curve = memnew(Button);

+ 3 - 3
editor/plugins/path_3d_editor_plugin.cpp

@@ -316,7 +316,7 @@ EditorPlugin::AfterGUIInput Path3DEditorPlugin::forward_spatial_gui_input(Camera
 			set_handle_clicked(false);
 		}
 
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->is_ctrl_pressed()))) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->is_ctrl_pressed()))) {
 			//click into curve, break it down
 			Vector<Vector3> v3a = c->tessellate();
 			int idx = 0;
@@ -411,7 +411,7 @@ EditorPlugin::AfterGUIInput Path3DEditorPlugin::forward_spatial_gui_input(Camera
 				//add new at pos
 			}
 
-		} else if (mb->is_pressed() && ((mb->get_button_index() == MOUSE_BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == MOUSE_BUTTON_RIGHT && curve_edit->is_pressed()))) {
+		} else if (mb->is_pressed() && ((mb->get_button_index() == MouseButton::LEFT && curve_del->is_pressed()) || (mb->get_button_index() == MouseButton::RIGHT && curve_edit->is_pressed()))) {
 			for (int i = 0; i < c->get_point_count(); i++) {
 				real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_position(i))).distance_to(mbpos);
 				real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_position(i) + c->get_point_out(i))).distance_to(mbpos);
@@ -573,7 +573,7 @@ Path3DEditorPlugin::Path3DEditorPlugin(EditorNode *p_node) {
 	curve_edit->set_toggle_mode(true);
 	curve_edit->hide();
 	curve_edit->set_focus_mode(Control::FOCUS_NONE);
-	curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
+	curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point"));
 	Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_edit);
 	curve_create = memnew(Button);
 	curve_create->set_flat(true);

+ 5 - 5
editor/plugins/polygon_2d_editor_plugin.cpp

@@ -447,7 +447,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
 	Ref<InputEventMouseButton> mb = p_input;
 
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				uv_drag_from = snap_point(mb->get_position());
 				uv_drag = true;
@@ -759,7 +759,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
 					bone_painting = false;
 				}
 			}
-		} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 			_cancel_editing();
 
 			if (bone_painting) {
@@ -768,9 +768,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
 
 			uv_edit_draw->update();
 
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed()) {
 			uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * mb->get_factor())));
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_pressed()) {
 			uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * mb->get_factor())));
 		}
 	}
@@ -778,7 +778,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
 	Ref<InputEventMouseMotion> mm = p_input;
 
 	if (mm.is_valid()) {
-		if ((mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
+		if ((mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE || Input::get_singleton()->is_key_pressed(Key::SPACE)) {
 			Vector2 drag = mm->get_relative();
 			uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
 			uv_vscroll->set_value(uv_vscroll->get_value() - drag.y);

+ 26 - 26
editor/plugins/script_editor_plugin.cpp

@@ -309,7 +309,7 @@ void ScriptEditorQuickOpen::_text_changed(const String &p_newtext) {
 void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
 	Ref<InputEventKey> k = p_ie;
 
-	if (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_PAGEUP || k->get_keycode() == KEY_PAGEDOWN)) {
+	if (k.is_valid() && (k->get_keycode() == Key::UP || k->get_keycode() == Key::DOWN || k->get_keycode() == Key::PAGEUP || k->get_keycode() == Key::PAGEDOWN)) {
 		search_options->gui_input(k);
 		search_box->accept_event();
 	}
@@ -1724,7 +1724,7 @@ void ScriptEditor::_help_overview_selected(int p_idx) {
 }
 
 void ScriptEditor::_script_selected(int p_idx) {
-	grab_focus_block = !Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT); //amazing hack, simply amazing
+	grab_focus_block = !Input::get_singleton()->is_mouse_button_pressed(MouseButton::LEFT); //amazing hack, simply amazing
 
 	_go_to_tab(script_list->get_item_metadata(p_idx));
 	grab_focus_block = false;
@@ -2951,11 +2951,11 @@ void ScriptEditor::input(const Ref<InputEvent> &p_event) {
 		// This must be hardcoded as the editor shortcuts dialog doesn't allow assigning
 		// more than one shortcut per action.
 		if (mb.is_valid() && mb->is_pressed() && is_visible_in_tree()) {
-			if (mb->get_button_index() == MOUSE_BUTTON_XBUTTON1) {
+			if (mb->get_button_index() == MouseButton::MB_XBUTTON1) {
 				_history_back();
 			}
 
-			if (mb->get_button_index() == MOUSE_BUTTON_XBUTTON2) {
+			if (mb->get_button_index() == MouseButton::MB_XBUTTON2) {
 				_history_forward();
 			}
 		}
@@ -2996,7 +2996,7 @@ void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) {
 	Ref<InputEventMouseButton> mb = ev;
 	if (mb.is_valid() && mb->is_pressed()) {
 		switch (mb->get_button_index()) {
-			case MOUSE_BUTTON_MIDDLE: {
+			case MouseButton::MIDDLE: {
 				// Right-click selects automatically; middle-click does not.
 				int idx = script_list->get_item_at_position(mb->get_position(), true);
 				if (idx >= 0) {
@@ -3006,7 +3006,7 @@ void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) {
 				}
 			} break;
 
-			case MOUSE_BUTTON_RIGHT: {
+			case MouseButton::RIGHT: {
 				_make_script_list_context_menu();
 			} break;
 			default:
@@ -3276,15 +3276,15 @@ void ScriptEditor::_update_selected_editor_menu() {
 	EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_current_tab_control());
 	script_search_menu->get_popup()->clear();
 	if (eh) {
-		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F), HELP_SEARCH_FIND);
-		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), HELP_SEARCH_FIND_NEXT);
-		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3), HELP_SEARCH_FIND_PREVIOUS);
+		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find..."), KeyModifierMask::CMD | Key::F), HELP_SEARCH_FIND);
+		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), Key::F3), HELP_SEARCH_FIND_NEXT);
+		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_previous", TTR("Find Previous"), KeyModifierMask::SHIFT | Key::F3), HELP_SEARCH_FIND_PREVIOUS);
 		script_search_menu->get_popup()->add_separator();
-		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
+		script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F), SEARCH_IN_FILES);
 		script_search_menu->show();
 	} else {
 		if (tab_container->get_child_count() == 0) {
-			script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F), SEARCH_IN_FILES);
+			script_search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_in_files", TTR("Find in Files"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F), SEARCH_IN_FILES);
 			script_search_menu->show();
 		} else {
 			script_search_menu->hide();
@@ -3668,11 +3668,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
 	find_replace_bar->hide();
 
 	ED_SHORTCUT("script_editor/window_sort", TTR("Sort"));
-	ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_UP);
-	ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_DOWN);
-	// FIXME: These should be `KEY_GREATER` and `KEY_LESS` but those don't work.
-	ED_SHORTCUT("script_editor/next_script", TTR("Next Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD);
-	ED_SHORTCUT("script_editor/prev_script", TTR("Previous Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COMMA);
+	ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::UP);
+	ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::DOWN);
+	// FIXME: These should be `Key::GREATER` and `Key::LESS` but those don't work.
+	ED_SHORTCUT("script_editor/next_script", TTR("Next Script"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::PERIOD);
+	ED_SHORTCUT("script_editor/prev_script", TTR("Previous Script"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::COMMA);
 	set_process_input(true);
 	set_process_unhandled_input(true);
 
@@ -3685,7 +3685,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new", TTR("New Script...")), FILE_NEW);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/new_textfile", TTR("New Text File...")), FILE_NEW_TEXTFILE);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/open", TTR("Open...")), FILE_OPEN);
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T), FILE_REOPEN_CLOSED);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::T), FILE_REOPEN_CLOSED);
 	file_menu->get_popup()->add_submenu_item(TTR("Open Recent"), "RecentScripts", FILE_OPEN_RECENT);
 
 	recent_scripts = memnew(PopupMenu);
@@ -3695,17 +3695,17 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
 	_update_recent_scripts();
 
 	file_menu->get_popup()->add_separator();
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KEY_MASK_ALT | KEY_MASK_CMD | KEY_S), FILE_SAVE);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KeyModifierMask::ALT | KeyModifierMask::CMD | Key::S), FILE_SAVE);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As...")), FILE_SAVE_AS);
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_S), FILE_SAVE_ALL);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::S), FILE_SAVE_ALL);
 	file_menu->get_popup()->add_separator();
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTR("Soft Reload Script"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_R), FILE_TOOL_RELOAD_SOFT);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTR("Soft Reload Script"), KeyModifierMask::CMD | KeyModifierMask::ALT | Key::R), FILE_TOOL_RELOAD_SOFT);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy_path", TTR("Copy Script Path")), FILE_COPY_PATH);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/show_in_file_system", TTR("Show in FileSystem")), SHOW_IN_FILE_SYSTEM);
 	file_menu->get_popup()->add_separator();
 
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Previous"), KEY_MASK_ALT | KEY_LEFT), WINDOW_PREV);
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_ALT | KEY_RIGHT), WINDOW_NEXT);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Previous"), KeyModifierMask::ALT | Key::LEFT), WINDOW_PREV);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KeyModifierMask::ALT | Key::RIGHT), WINDOW_NEXT);
 	file_menu->get_popup()->add_separator();
 
 	file_menu->get_popup()->add_submenu_item(TTR("Theme"), "Theme", FILE_THEME);
@@ -3722,16 +3722,16 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
 	theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/save_theme_as", TTR("Save Theme As...")), THEME_SAVE_AS);
 
 	file_menu->get_popup()->add_separator();
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KeyModifierMask::CMD | Key::W), FILE_CLOSE);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTR("Close All")), CLOSE_ALL);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_other_tabs", TTR("Close Other Tabs")), CLOSE_OTHER_TABS);
 	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS);
 
 	file_menu->get_popup()->add_separator();
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTR("Run"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X), FILE_RUN);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTR("Run"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::X), FILE_RUN);
 
 	file_menu->get_popup()->add_separator();
-	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH), TOGGLE_SCRIPTS_PANEL);
+	file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KeyModifierMask::CMD | Key::BACKSLASH), TOGGLE_SCRIPTS_PANEL);
 	file_menu->get_popup()->connect("id_pressed", callable_mp(this, &ScriptEditor::_menu_option));
 
 	script_search_menu = memnew(MenuButton);
@@ -3984,7 +3984,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
 	EDITOR_DEF("text_editor/external/exec_flags", "{file}");
 	EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "text_editor/external/exec_flags", PROPERTY_HINT_PLACEHOLDER_TEXT, "Call flags with placeholders: {project}, {file}, {col}, {line}."));
 
-	ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_T);
+	ED_SHORTCUT("script_editor/reopen_closed_script", TTR("Reopen Closed Script"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::T);
 	ED_SHORTCUT("script_editor/clear_recent", TTR("Clear Recent Scripts"));
 }
 

+ 44 - 44
editor/plugins/script_text_editor.cpp

@@ -1462,7 +1462,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
 		Array files = d["files"];
 
 		String text_to_drop;
-		bool preload = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+		bool preload = Input::get_singleton()->is_key_pressed(Key::CTRL);
 		for (int i = 0; i < files.size(); i++) {
 			if (i > 0) {
 				text_to_drop += ", ";
@@ -1526,7 +1526,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
 	bool create_menu = false;
 
 	CodeEdit *tx = code_editor->get_text_editor();
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 		local_pos = mb->get_global_position() - tx->get_global_position();
 		create_menu = true;
 	} else if (k.is_valid() && k->is_action("ui_menu", true)) {
@@ -1804,9 +1804,9 @@ void ScriptTextEditor::_enable_code_editor() {
 
 	edit_menu->get_popup()->add_child(convert_case);
 	edit_menu->get_popup()->add_submenu_item(TTR("Convert Case"), "convert_case");
-	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KEY_MASK_SHIFT | KEY_F4), EDIT_TO_UPPERCASE);
-	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KEY_MASK_SHIFT | KEY_F5), EDIT_TO_LOWERCASE);
-	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KEY_MASK_SHIFT | KEY_F6), EDIT_CAPITALIZE);
+	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_uppercase", TTR("Uppercase"), KeyModifierMask::SHIFT | Key::F4), EDIT_TO_UPPERCASE);
+	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/convert_to_lowercase", TTR("Lowercase"), KeyModifierMask::SHIFT | Key::F5), EDIT_TO_LOWERCASE);
+	convert_case->add_shortcut(ED_SHORTCUT("script_text_editor/capitalize", TTR("Capitalize"), KeyModifierMask::SHIFT | Key::F6), EDIT_CAPITALIZE);
 	convert_case->connect("id_pressed", callable_mp(this, &ScriptTextEditor::_edit_option));
 
 	edit_menu->get_popup()->add_child(highlighter_menu);
@@ -1953,60 +1953,60 @@ static ScriptEditorBase *create_editor(const RES &p_resource) {
 }
 
 void ScriptTextEditor::register_editor() {
-	ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT | KEY_UP);
-	ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT | KEY_DOWN);
-	ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_K);
+	ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KeyModifierMask::ALT | Key::UP);
+	ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KeyModifierMask::ALT | Key::DOWN);
+	ED_SHORTCUT("script_text_editor/delete_line", TTR("Delete Line"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::K);
 
 	// Leave these at zero, same can be accomplished with tab/shift-tab, including selection.
 	// The next/previous in history shortcut in this case makes a lot more sense.
 
-	ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), KEY_NONE);
-	ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), KEY_NONE);
-	ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD | KEY_K);
-	ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KEY_MASK_ALT | KEY_F);
-	ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), KEY_NONE);
-	ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), KEY_NONE);
-	ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_D);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/duplicate_selection", "macos", KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_C);
-	ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_E);
-	ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
-	ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
-	ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent to Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_I);
-	ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I);
+	ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), Key::NONE);
+	ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), Key::NONE);
+	ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KeyModifierMask::CMD | Key::K);
+	ED_SHORTCUT("script_text_editor/toggle_fold_line", TTR("Fold/Unfold Line"), KeyModifierMask::ALT | Key::F);
+	ED_SHORTCUT("script_text_editor/fold_all_lines", TTR("Fold All Lines"), Key::NONE);
+	ED_SHORTCUT("script_text_editor/unfold_all_lines", TTR("Unfold All Lines"), Key::NONE);
+	ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KeyModifierMask::SHIFT | KeyModifierMask::CMD | Key::D);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/duplicate_selection", "macos", KeyModifierMask::SHIFT | KeyModifierMask::CMD | Key::C);
+	ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::E);
+	ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KeyModifierMask::CMD | KeyModifierMask::ALT | Key::T);
+	ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::Y);
+	ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent to Tabs"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::I);
+	ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KeyModifierMask::CMD | Key::I);
 
-	ED_SHORTCUT_AND_COMMAND("script_text_editor/find", TTR("Find..."), KEY_MASK_CMD | KEY_F);
+	ED_SHORTCUT_AND_COMMAND("script_text_editor/find", TTR("Find..."), KeyModifierMask::CMD | Key::F);
 
-	ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), KEY_F3);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/find_next", "macos", KEY_MASK_CMD | KEY_G);
+	ED_SHORTCUT("script_text_editor/find_next", TTR("Find Next"), Key::F3);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/find_next", "macos", KeyModifierMask::CMD | Key::G);
 
-	ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KEY_MASK_SHIFT | KEY_F3);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/find_previous", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_G);
+	ED_SHORTCUT("script_text_editor/find_previous", TTR("Find Previous"), KeyModifierMask::SHIFT | Key::F3);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/find_previous", "macos", KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::G);
 
-	ED_SHORTCUT_AND_COMMAND("script_text_editor/replace", TTR("Replace..."), KEY_MASK_CMD | KEY_R);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/replace", "macos", KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
+	ED_SHORTCUT_AND_COMMAND("script_text_editor/replace", TTR("Replace..."), KeyModifierMask::CMD | Key::R);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/replace", "macos", KeyModifierMask::ALT | KeyModifierMask::CMD | Key::F);
 
-	ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F);
-	ED_SHORTCUT("script_text_editor/replace_in_files", TTR("Replace in Files..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R);
+	ED_SHORTCUT("script_text_editor/find_in_files", TTR("Find in Files..."), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F);
+	ED_SHORTCUT("script_text_editor/replace_in_files", TTR("Replace in Files..."), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::R);
 
-	ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KEY_MASK_ALT | KEY_F1);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/contextual_help", "macos", KEY_MASK_ALT | KEY_MASK_SHIFT | KEY_SPACE);
+	ED_SHORTCUT("script_text_editor/contextual_help", TTR("Contextual Help"), KeyModifierMask::ALT | Key::F1);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/contextual_help", "macos", KeyModifierMask::ALT | KeyModifierMask::SHIFT | Key::SPACE);
 
-	ED_SHORTCUT("script_text_editor/toggle_bookmark", TTR("Toggle Bookmark"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_B);
-	ED_SHORTCUT("script_text_editor/goto_next_bookmark", TTR("Go to Next Bookmark"), KEY_MASK_CMD | KEY_B);
-	ED_SHORTCUT("script_text_editor/goto_previous_bookmark", TTR("Go to Previous Bookmark"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
-	ED_SHORTCUT("script_text_editor/remove_all_bookmarks", TTR("Remove All Bookmarks"), KEY_NONE);
+	ED_SHORTCUT("script_text_editor/toggle_bookmark", TTR("Toggle Bookmark"), KeyModifierMask::CMD | KeyModifierMask::ALT | Key::B);
+	ED_SHORTCUT("script_text_editor/goto_next_bookmark", TTR("Go to Next Bookmark"), KeyModifierMask::CMD | Key::B);
+	ED_SHORTCUT("script_text_editor/goto_previous_bookmark", TTR("Go to Previous Bookmark"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::B);
+	ED_SHORTCUT("script_text_editor/remove_all_bookmarks", TTR("Remove All Bookmarks"), Key::NONE);
 
-	ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KEY_MASK_ALT | KEY_MASK_CMD | KEY_F);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/goto_function", "macos", KEY_MASK_CTRL | KEY_MASK_CMD | KEY_J);
+	ED_SHORTCUT("script_text_editor/goto_function", TTR("Go to Function..."), KeyModifierMask::ALT | KeyModifierMask::CMD | Key::F);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/goto_function", "macos", KeyModifierMask::CTRL | KeyModifierMask::CMD | Key::J);
 
-	ED_SHORTCUT("script_text_editor/goto_line", TTR("Go to Line..."), KEY_MASK_CMD | KEY_L);
+	ED_SHORTCUT("script_text_editor/goto_line", TTR("Go to Line..."), KeyModifierMask::CMD | Key::L);
 
-	ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
-	ED_SHORTCUT_OVERRIDE("script_text_editor/toggle_breakpoint", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B);
+	ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), Key::F9);
+	ED_SHORTCUT_OVERRIDE("script_text_editor/toggle_breakpoint", "macos", KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::B);
 
-	ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F9);
-	ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Go to Next Breakpoint"), KEY_MASK_CMD | KEY_PERIOD);
-	ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Go to Previous Breakpoint"), KEY_MASK_CMD | KEY_COMMA);
+	ED_SHORTCUT("script_text_editor/remove_all_breakpoints", TTR("Remove All Breakpoints"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F9);
+	ED_SHORTCUT("script_text_editor/goto_next_breakpoint", TTR("Go to Next Breakpoint"), KeyModifierMask::CMD | Key::PERIOD);
+	ED_SHORTCUT("script_text_editor/goto_previous_breakpoint", TTR("Go to Previous Breakpoint"), KeyModifierMask::CMD | Key::COMMA);
 
 	ScriptEditor::register_create_script_editor_function(create_editor);
 }

+ 1 - 1
editor/plugins/shader_editor_plugin.cpp

@@ -552,7 +552,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
 	Ref<InputEventMouseButton> mb = ev;
 
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+		if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 			CodeEdit *tx = shader_editor->get_text_editor();
 
 			Point2i pos = tx->get_line_column_at_pos(mb->get_global_position() - tx->get_global_position());

+ 3 - 3
editor/plugins/skeleton_3d_editor_plugin.cpp

@@ -681,7 +681,7 @@ void Skeleton3DEditor::create_editors() {
 	key_insert_button->set_focus_mode(FOCUS_NONE);
 	key_insert_button->connect("pressed", callable_mp(this, &Skeleton3DEditor::insert_keys), varray(false));
 	key_insert_button->set_tooltip(TTR("Insert key of bone poses already exist track."));
-	key_insert_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_to_existing_tracks", TTR("Insert Key (Existing Tracks)"), KEY_INSERT));
+	key_insert_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_to_existing_tracks", TTR("Insert Key (Existing Tracks)"), Key::INSERT));
 	animation_hb->add_child(key_insert_button);
 
 	key_insert_all_button = memnew(Button);
@@ -689,7 +689,7 @@ void Skeleton3DEditor::create_editors() {
 	key_insert_all_button->set_focus_mode(FOCUS_NONE);
 	key_insert_all_button->connect("pressed", callable_mp(this, &Skeleton3DEditor::insert_keys), varray(true));
 	key_insert_all_button->set_tooltip(TTR("Insert key of all bone poses."));
-	key_insert_all_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_of_all_bones", TTR("Insert Key (All Bones)"), KEY_MASK_CMD + KEY_INSERT));
+	key_insert_all_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_of_all_bones", TTR("Insert Key (All Bones)"), KeyModifierMask::CMD + Key::INSERT));
 	animation_hb->add_child(key_insert_all_button);
 
 	// Bone tree.
@@ -1028,7 +1028,7 @@ EditorPlugin::AfterGUIInput Skeleton3DEditorPlugin::forward_spatial_gui_input(Ca
 	Node3DEditor *ne = Node3DEditor::get_singleton();
 	if (se->is_edit_mode()) {
 		const Ref<InputEventMouseButton> mb = p_event;
-		if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 			if (ne->get_tool_mode() != Node3DEditor::TOOL_MODE_SELECT) {
 				if (!ne->is_gizmo_visible()) {
 					return EditorPlugin::AFTER_GUI_INPUT_STOP;

+ 8 - 8
editor/plugins/sprite_frames_editor_plugin.cpp

@@ -126,7 +126,7 @@ void SpriteFramesEditor::_sheet_preview_draw() {
 
 void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
 	const Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		const int idx = _sheet_preview_position_to_frame_index(mb->get_position());
 
 		if (idx != -1) {
@@ -166,12 +166,12 @@ void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
 		}
 	}
 
-	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		frames_toggled_by_mouse_hover.clear();
 	}
 
 	const Ref<InputEventMouseMotion> mm = p_event;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		// Select by holding down the mouse button on frames.
 		const int idx = _sheet_preview_position_to_frame_index(mm->get_position());
 
@@ -200,11 +200,11 @@ void SpriteFramesEditor::_sheet_scroll_input(const Ref<InputEvent> &p_event) {
 		// Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer
 		// to allow performing this action anywhere, even if the cursor isn't
 		// hovering the texture in the workspace.
-		if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) {
+		if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) {
 			_sheet_zoom_in();
 			// Don't scroll up after zooming in.
 			accept_event();
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) {
 			_sheet_zoom_out();
 			// Don't scroll down after zooming out.
 			accept_event();
@@ -746,11 +746,11 @@ void SpriteFramesEditor::_tree_input(const Ref<InputEvent> &p_event) {
 	const Ref<InputEventMouseButton> mb = p_event;
 
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) {
+		if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed() && mb->is_ctrl_pressed()) {
 			_zoom_in();
 			// Don't scroll up after zooming in.
 			accept_event();
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_pressed() && mb->is_ctrl_pressed()) {
 			_zoom_out();
 			// Don't scroll down after zooming out.
 			accept_event();
@@ -1006,7 +1006,7 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
 	if (String(d["type"]) == "files") {
 		Vector<String> files = d["files"];
 
-		if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+		if (Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 			_prepare_sprite_sheet(files[0]);
 		} else {
 			_file_load_request(files, at_pos);

+ 1 - 1
editor/plugins/text_editor.cpp

@@ -425,7 +425,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
 	Ref<InputEventMouseButton> mb = ev;
 
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->get_button_index() == MouseButton::RIGHT) {
 			CodeEdit *tx = code_editor->get_text_editor();
 
 			Point2i pos = tx->get_line_column_at_pos(mb->get_global_position() - tx->get_global_position());

+ 1 - 1
editor/plugins/texture_layered_editor_plugin.cpp

@@ -38,7 +38,7 @@ void TextureLayeredEditor::gui_input(const Ref<InputEvent> &p_event) {
 	ERR_FAIL_COND(p_event.is_null());
 
 	Ref<InputEventMouseMotion> mm = p_event;
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		y_rot += -mm->get_relative().x * 0.01;
 		x_rot += mm->get_relative().y * 0.01;
 		_update_material();

+ 6 - 6
editor/plugins/texture_region_editor_plugin.cpp

@@ -284,7 +284,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
 
 	Ref<InputEventMouseButton> mb = p_input;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (node_ninepatch || obj_styleBox.is_valid()) {
 					edited_margin = -1;
@@ -330,7 +330,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
 					for (const Rect2 &E : autoslice_cache) {
 						if (E.has_point(point)) {
 							rect = E;
-							if (Input::get_singleton()->is_key_pressed(KEY_CTRL) && !(Input::get_singleton()->is_key_pressed(Key(KEY_SHIFT | KEY_ALT)))) {
+							if (Input::get_singleton()->is_key_pressed(Key::CTRL) && !(Input::get_singleton()->is_key_pressed(Key(Key::SHIFT | Key::ALT)))) {
 								Rect2 r;
 								if (atlas_tex.is_valid()) {
 									r = atlas_tex->get_region();
@@ -446,7 +446,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
 				creating = false;
 			}
 
-		} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::RIGHT && mb->is_pressed()) {
 			if (drag) {
 				drag = false;
 				if (edited_margin >= 0) {
@@ -465,9 +465,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
 					drag_index = -1;
 				}
 			}
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_pressed()) {
 			_zoom_on_position(draw_zoom * ((0.95 + (0.05 * mb->get_factor())) / 0.95), mb->get_position());
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_pressed()) {
 			_zoom_on_position(draw_zoom * (1 - (0.05 * mb->get_factor())), mb->get_position());
 		}
 	}
@@ -475,7 +475,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
 	Ref<InputEventMouseMotion> mm = p_input;
 
 	if (mm.is_valid()) {
-		if (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
+		if ((mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE || Input::get_singleton()->is_key_pressed(Key::SPACE)) {
 			Vector2 dragged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom);
 			hscroll->set_value(hscroll->get_value() - dragged.x);
 			vscroll->set_value(vscroll->get_value() - dragged.y);

+ 3 - 3
editor/plugins/theme_editor_plugin.cpp

@@ -1711,13 +1711,13 @@ void ThemeItemEditorDialog::_edit_theme_item_gui_input(const Ref<InputEvent> &p_
 		}
 
 		switch (k->get_keycode()) {
-			case KEY_KP_ENTER:
-			case KEY_ENTER: {
+			case Key::KP_ENTER:
+			case Key::ENTER: {
 				_confirm_edit_theme_item();
 				edit_theme_item_dialog->hide();
 				edit_theme_item_dialog->set_input_as_handled();
 			} break;
-			case KEY_ESCAPE: {
+			case Key::ESCAPE: {
 				edit_theme_item_dialog->hide();
 				edit_theme_item_dialog->set_input_as_handled();
 			} break;

+ 1 - 1
editor/plugins/theme_editor_preview.cpp

@@ -144,7 +144,7 @@ void ThemeEditorPreview::_gui_input_picker_overlay(const Ref<InputEvent> &p_even
 
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		if (hovered_control) {
 			StringName theme_type = hovered_control->get_theme_type_variation();
 			if (theme_type == StringName()) {

+ 2 - 2
editor/plugins/tiles/tile_atlas_view.cpp

@@ -46,7 +46,7 @@ void TileAtlasView::gui_input(const Ref<InputEvent> &p_event) {
 	if (mb.is_valid()) {
 		drag_type = DRAG_TYPE_NONE;
 
-		Vector2i scroll_vec = Vector2((mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT) - (mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT), (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) - (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN));
+		Vector2i scroll_vec = Vector2((mb->get_button_index() == MouseButton::WHEEL_LEFT) - (mb->get_button_index() == MouseButton::WHEEL_RIGHT), (mb->get_button_index() == MouseButton::WHEEL_UP) - (mb->get_button_index() == MouseButton::WHEEL_DOWN));
 		if (scroll_vec != Vector2()) {
 			if (mb->is_ctrl_pressed()) {
 				if (mb->is_shift_pressed()) {
@@ -69,7 +69,7 @@ void TileAtlasView::gui_input(const Ref<InputEvent> &p_event) {
 			}
 		}
 
-		if (mb->get_button_index() == MOUSE_BUTTON_MIDDLE || mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->get_button_index() == MouseButton::MIDDLE || mb->get_button_index() == MouseButton::RIGHT) {
 			if (mb->is_pressed()) {
 				drag_type = DRAG_TYPE_PAN;
 			} else {

+ 11 - 11
editor/plugins/tiles/tile_data_editors.cpp

@@ -449,15 +449,15 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event)
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_ctrl_pressed()) {
+		if (mb->get_button_index() == MouseButton::WHEEL_UP && mb->is_ctrl_pressed()) {
 			editor_zoom_widget->set_zoom_by_increments(1);
 			_zoom_changed();
 			accept_event();
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_ctrl_pressed()) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && mb->is_ctrl_pressed()) {
 			editor_zoom_widget->set_zoom_by_increments(-1);
 			_zoom_changed();
 			accept_event();
-		} else if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		} else if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (tools_button_group->get_pressed_button() != button_create) {
 					in_creation_polygon.clear();
@@ -554,7 +554,7 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event)
 				drag_point_index = -1;
 			}
 
-		} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		} else if (mb->get_button_index() == MouseButton::RIGHT) {
 			if (mb->is_pressed()) {
 				if (tools_button_group->get_pressed_button() == button_edit) {
 					// Remove point or pan.
@@ -588,7 +588,7 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref<InputEvent> p_event)
 			} else {
 				drag_type = DRAG_TYPE_NONE;
 			}
-		} else if (mb->get_button_index() == MOUSE_BUTTON_MIDDLE) {
+		} else if (mb->get_button_index() == MouseButton::MIDDLE) {
 			if (mb->is_pressed()) {
 				drag_type = DRAG_TYPE_PAN;
 				drag_last_pos = mb->get_position();
@@ -929,7 +929,7 @@ void TileDataDefaultEditor::forward_painting_atlas_gui_input(TileAtlasView *p_ti
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (picker_button->is_pressed()) {
 					Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position());
@@ -1020,7 +1020,7 @@ void TileDataDefaultEditor::forward_painting_alternatives_gui_input(TileAtlasVie
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (picker_button->is_pressed()) {
 					Vector3i tile = p_tile_atlas_view->get_alternative_tile_at_pos(mb->get_position());
@@ -1175,7 +1175,7 @@ TileDataDefaultEditor::TileDataDefaultEditor() {
 	picker_button = memnew(Button);
 	picker_button->set_flat(true);
 	picker_button->set_toggle_mode(true);
-	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", KEY_P));
+	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P));
 	toolbar->add_child(picker_button);
 }
 
@@ -1966,7 +1966,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (picker_button->is_pressed()) {
 					Vector2i coords = p_tile_atlas_view->get_atlas_tile_coords_at_pos(mb->get_position());
@@ -2307,7 +2307,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				if (picker_button->is_pressed()) {
 					Vector3i tile = p_tile_atlas_view->get_alternative_tile_at_pos(mb->get_position());
@@ -2478,7 +2478,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() {
 	picker_button = memnew(Button);
 	picker_button->set_flat(true);
 	picker_button->set_toggle_mode(true);
-	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", KEY_P));
+	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P));
 	toolbar->add_child(picker_button);
 
 	// Setup

+ 39 - 39
editor/plugins/tiles/tile_map_editor.cpp

@@ -415,7 +415,7 @@ void TileMapEditorTilesPlugin::_scenes_list_multi_selected(int p_index, bool p_s
 	TileMapCell selected = TileMapCell(source_id, Vector2i(), scene_id);
 
 	// Clear the selection if shift is not pressed.
-	if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (!Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		tile_set_selection.clear();
 	}
 
@@ -590,10 +590,10 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
 		Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * tile_map->get_global_transform();
 		Vector2 mpos = xform.affine_inverse().xform(mb->get_position());
 
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT || mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->get_button_index() == MouseButton::LEFT || mb->get_button_index() == MouseButton::RIGHT) {
 			if (mb->is_pressed()) {
 				// Pressed
-				if (erase_button->is_pressed() || mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+				if (erase_button->is_pressed() || mb->get_button_index() == MouseButton::RIGHT) {
 					drag_erasing = true;
 				}
 
@@ -617,12 +617,12 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
 					}
 				} else {
 					// Check if we are picking a tile.
-					if (picker_button->is_pressed() || (Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
+					if (picker_button->is_pressed() || (Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT))) {
 						drag_type = DRAG_TYPE_PICK;
 						drag_start_mouse_pos = mpos;
 					} else {
 						// Paint otherwise.
-						if (tool_buttons_group->get_pressed_button() == paint_tool_button && !Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+						if (tool_buttons_group->get_pressed_button() == paint_tool_button && !Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 							drag_type = DRAG_TYPE_PAINT;
 							drag_start_mouse_pos = mpos;
 							drag_modified.clear();
@@ -638,11 +638,11 @@ bool TileMapEditorTilesPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p
 								tile_map->set_cell(tile_map_layer, coords, E.value.source_id, E.value.get_atlas_coords(), E.value.alternative_tile);
 							}
 							_fix_invalid_tiles_in_tile_map_selection();
-						} else if (tool_buttons_group->get_pressed_button() == line_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(KEY_SHIFT) && !Input::get_singleton()->is_key_pressed(KEY_CTRL))) {
+						} else if (tool_buttons_group->get_pressed_button() == line_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(Key::SHIFT) && !Input::get_singleton()->is_key_pressed(Key::CTRL))) {
 							drag_type = DRAG_TYPE_LINE;
 							drag_start_mouse_pos = mpos;
 							drag_modified.clear();
-						} else if (tool_buttons_group->get_pressed_button() == rect_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(KEY_SHIFT) && Input::get_singleton()->is_key_pressed(KEY_CTRL))) {
+						} else if (tool_buttons_group->get_pressed_button() == rect_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(Key::SHIFT) && Input::get_singleton()->is_key_pressed(Key::CTRL))) {
 							drag_type = DRAG_TYPE_RECT;
 							drag_start_mouse_pos = mpos;
 							drag_modified.clear();
@@ -713,7 +713,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
 	// Draw the selection.
 	if ((tiles_bottom_panel->is_visible_in_tree() || patterns_bottom_panel->is_visible_in_tree()) && tool_buttons_group->get_pressed_button() == select_tool_button) {
 		// In select mode, we only draw the current selection if we are modifying it (pressing control or shift).
-		if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
+		if (drag_type == DRAG_TYPE_MOVE || (drag_type == DRAG_TYPE_SELECT && !Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT))) {
 			// Do nothing
 		} else {
 			Color grid_color = EditorSettings::get_singleton()->get("editors/tiles_editor/grid_color");
@@ -783,7 +783,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
 				Vector2i coords = tile_map->map_pattern(tile_map->world_to_map(drag_last_mouse_pos - mouse_offset), clipboard_used_cells[i], tile_map_clipboard);
 				preview[coords] = TileMapCell(tile_map_clipboard->get_cell_source_id(clipboard_used_cells[i]), tile_map_clipboard->get_cell_atlas_coords(clipboard_used_cells[i]), tile_map_clipboard->get_cell_alternative_tile(clipboard_used_cells[i]));
 			}
-		} else if (!picker_button->is_pressed() && !(drag_type == DRAG_TYPE_NONE && Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
+		} else if (!picker_button->is_pressed() && !(drag_type == DRAG_TYPE_NONE && Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT))) {
 			bool expand_grid = false;
 			if (tool_buttons_group->get_pressed_button() == paint_tool_button && drag_type == DRAG_TYPE_NONE) {
 				// Preview for a single pattern.
@@ -1212,14 +1212,14 @@ void TileMapEditorTilesPlugin::_stop_dragging() {
 			undo_redo->create_action(TTR("Change selection"));
 			undo_redo->add_undo_method(this, "_set_tile_map_selection", _get_tile_map_selection());
 
-			if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT) && !Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+			if (!Input::get_singleton()->is_key_pressed(Key::SHIFT) && !Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 				tile_map_selection.clear();
 			}
 			Rect2i rect = Rect2i(tile_map->world_to_map(drag_start_mouse_pos), tile_map->world_to_map(mpos) - tile_map->world_to_map(drag_start_mouse_pos)).abs();
 			for (int x = rect.position.x; x <= rect.get_end().x; x++) {
 				for (int y = rect.position.y; y <= rect.get_end().y; y++) {
 					Vector2i coords = Vector2i(x, y);
-					if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) {
+					if (Input::get_singleton()->is_key_pressed(Key::CTRL)) {
 						if (tile_map_selection.has(coords)) {
 							tile_map_selection.erase(coords);
 						}
@@ -1734,7 +1734,7 @@ void TileMapEditorTilesPlugin::_tile_atlas_control_gui_input(const Ref<InputEven
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_pressed()) { // Pressed
 			tile_set_dragging_selection = true;
 			tile_set_drag_start_mouse_pos = tile_atlas_control->get_local_mouse_position();
@@ -1892,7 +1892,7 @@ void TileMapEditorTilesPlugin::_tile_alternatives_control_gui_input(const Ref<In
 	}
 
 	Ref<InputEventMouseButton> mb = p_event;
-	if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_pressed()) { // Pressed
 			// Left click pressed.
 			if (!mb->is_shift_pressed()) {
@@ -1957,11 +1957,11 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	CanvasItemEditor::get_singleton()->get_viewport_control()->connect("mouse_exited", callable_mp(this, &TileMapEditorTilesPlugin::_mouse_exited_viewport));
 
 	// --- Shortcuts ---
-	ED_SHORTCUT("tiles_editor/cut", TTR("Cut"), KEY_MASK_CMD | KEY_X);
-	ED_SHORTCUT("tiles_editor/copy", TTR("Copy"), KEY_MASK_CMD | KEY_C);
-	ED_SHORTCUT("tiles_editor/paste", TTR("Paste"), KEY_MASK_CMD | KEY_V);
-	ED_SHORTCUT("tiles_editor/cancel", TTR("Cancel"), KEY_ESCAPE);
-	ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), KEY_DELETE);
+	ED_SHORTCUT("tiles_editor/cut", TTR("Cut"), KeyModifierMask::CMD | Key::X);
+	ED_SHORTCUT("tiles_editor/copy", TTR("Copy"), KeyModifierMask::CMD | Key::C);
+	ED_SHORTCUT("tiles_editor/paste", TTR("Paste"), KeyModifierMask::CMD | Key::V);
+	ED_SHORTCUT("tiles_editor/cancel", TTR("Cancel"), Key::ESCAPE);
+	ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), Key::KEY_DELETE);
 
 	// --- Initialize references ---
 	tile_map_clipboard.instantiate();
@@ -1979,7 +1979,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	select_tool_button->set_flat(true);
 	select_tool_button->set_toggle_mode(true);
 	select_tool_button->set_button_group(tool_buttons_group);
-	select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", "Selection", KEY_S));
+	select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", "Selection", Key::S));
 	select_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(select_tool_button);
 
@@ -1987,7 +1987,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	paint_tool_button->set_flat(true);
 	paint_tool_button->set_toggle_mode(true);
 	paint_tool_button->set_button_group(tool_buttons_group);
-	paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", "Paint", KEY_D));
+	paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", "Paint", Key::D));
 	paint_tool_button->set_tooltip(TTR("Shift: Draw line.") + "\n" + TTR("Shift+Ctrl: Draw rectangle."));
 	paint_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(paint_tool_button);
@@ -1996,7 +1996,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	line_tool_button->set_flat(true);
 	line_tool_button->set_toggle_mode(true);
 	line_tool_button->set_button_group(tool_buttons_group);
-	line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", "Line", KEY_L));
+	line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", "Line", Key::L));
 	line_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(line_tool_button);
 
@@ -2004,7 +2004,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	rect_tool_button->set_flat(true);
 	rect_tool_button->set_toggle_mode(true);
 	rect_tool_button->set_button_group(tool_buttons_group);
-	rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", "Rect", KEY_R));
+	rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", "Rect", Key::R));
 	rect_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(rect_tool_button);
 
@@ -2012,7 +2012,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	bucket_tool_button->set_flat(true);
 	bucket_tool_button->set_toggle_mode(true);
 	bucket_tool_button->set_button_group(tool_buttons_group);
-	bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", "Bucket", KEY_B));
+	bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", "Bucket", Key::B));
 	bucket_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
 	toolbar->add_child(tilemap_tiles_tools_buttons);
@@ -2028,7 +2028,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	picker_button = memnew(Button);
 	picker_button->set_flat(true);
 	picker_button->set_toggle_mode(true);
-	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", KEY_P));
+	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P));
 	picker_button->set_tooltip(TTR("Alternatively hold Ctrl with other tools to pick tile."));
 	picker_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
 	tools_settings->add_child(picker_button);
@@ -2037,7 +2037,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
 	erase_button = memnew(Button);
 	erase_button->set_flat(true);
 	erase_button->set_toggle_mode(true);
-	erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", KEY_E));
+	erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", Key::E));
 	erase_button->set_tooltip(TTR("Alternatively use RMB to erase tiles."));
 	erase_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
 	tools_settings->add_child(erase_button);
@@ -2766,10 +2766,10 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent>
 		Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * tile_map->get_global_transform();
 		Vector2 mpos = xform.affine_inverse().xform(mb->get_position());
 
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT || mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		if (mb->get_button_index() == MouseButton::LEFT || mb->get_button_index() == MouseButton::RIGHT) {
 			if (mb->is_pressed()) {
 				// Pressed
-				if (erase_button->is_pressed() || mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+				if (erase_button->is_pressed() || mb->get_button_index() == MouseButton::RIGHT) {
 					drag_erasing = true;
 				}
 
@@ -2777,7 +2777,7 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent>
 					drag_type = DRAG_TYPE_PICK;
 				} else {
 					// Paint otherwise.
-					if (tool_buttons_group->get_pressed_button() == paint_tool_button && !Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+					if (tool_buttons_group->get_pressed_button() == paint_tool_button && !Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 						if (selected_terrain_set < 0 || !selected_terrains_pattern.is_valid()) {
 							return true;
 						}
@@ -2792,14 +2792,14 @@ bool TileMapEditorTerrainsPlugin::forward_canvas_gui_input(const Ref<InputEvent>
 							drag_modified[E.key] = tile_map->get_cell(tile_map_layer, E.key);
 							tile_map->set_cell(tile_map_layer, E.key, E.value.source_id, E.value.get_atlas_coords(), E.value.alternative_tile);
 						}
-					} else if (tool_buttons_group->get_pressed_button() == line_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(KEY_SHIFT) && !Input::get_singleton()->is_key_pressed(KEY_CTRL))) {
+					} else if (tool_buttons_group->get_pressed_button() == line_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(Key::SHIFT) && !Input::get_singleton()->is_key_pressed(Key::CTRL))) {
 						if (selected_terrain_set < 0 || !selected_terrains_pattern.is_valid()) {
 							return true;
 						}
 						drag_type = DRAG_TYPE_LINE;
 						drag_start_mouse_pos = mpos;
 						drag_modified.clear();
-					} else if (tool_buttons_group->get_pressed_button() == rect_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(KEY_SHIFT) && Input::get_singleton()->is_key_pressed(KEY_CTRL))) {
+					} else if (tool_buttons_group->get_pressed_button() == rect_tool_button || (tool_buttons_group->get_pressed_button() == paint_tool_button && Input::get_singleton()->is_key_pressed(Key::SHIFT) && Input::get_singleton()->is_key_pressed(Key::CTRL))) {
 						if (selected_terrain_set < 0 || !selected_terrains_pattern.is_valid()) {
 							return true;
 						}
@@ -2884,7 +2884,7 @@ void TileMapEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control *p_o
 				tile_xform.set_scale(tile_shape_size);
 				tile_set->draw_tile_shape(p_overlay, xform * tile_xform, Color(1.0, 1.0, 1.0), false);
 			}
-		} else if (!picker_button->is_pressed() && !(drag_type == DRAG_TYPE_NONE && Input::get_singleton()->is_key_pressed(KEY_CTRL) && !Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
+		} else if (!picker_button->is_pressed() && !(drag_type == DRAG_TYPE_NONE && Input::get_singleton()->is_key_pressed(Key::CTRL) && !Input::get_singleton()->is_key_pressed(Key::SHIFT))) {
 			bool expand_grid = false;
 			if (tool_buttons_group->get_pressed_button() == paint_tool_button && drag_type == DRAG_TYPE_NONE) {
 				// Preview for a single tile.
@@ -3230,7 +3230,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
 	paint_tool_button->set_toggle_mode(true);
 	paint_tool_button->set_button_group(tool_buttons_group);
 	paint_tool_button->set_pressed(true);
-	paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", "Paint", KEY_D));
+	paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", "Paint", Key::D));
 	paint_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(paint_tool_button);
 
@@ -3238,7 +3238,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
 	line_tool_button->set_flat(true);
 	line_tool_button->set_toggle_mode(true);
 	line_tool_button->set_button_group(tool_buttons_group);
-	line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", "Line", KEY_L));
+	line_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/line_tool", "Line", Key::L));
 	line_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(line_tool_button);
 
@@ -3246,7 +3246,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
 	rect_tool_button->set_flat(true);
 	rect_tool_button->set_toggle_mode(true);
 	rect_tool_button->set_button_group(tool_buttons_group);
-	rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", "Rect", KEY_R));
+	rect_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/rect_tool", "Rect", Key::R));
 	rect_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(rect_tool_button);
 
@@ -3254,7 +3254,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
 	bucket_tool_button->set_flat(true);
 	bucket_tool_button->set_toggle_mode(true);
 	bucket_tool_button->set_button_group(tool_buttons_group);
-	bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", "Bucket", KEY_B));
+	bucket_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/bucket_tool", "Bucket", Key::B));
 	bucket_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_toolbar));
 	tilemap_tiles_tools_buttons->add_child(bucket_tool_button);
 
@@ -3271,7 +3271,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
 	picker_button = memnew(Button);
 	picker_button->set_flat(true);
 	picker_button->set_toggle_mode(true);
-	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", KEY_P));
+	picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P));
 	picker_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
 	tools_settings->add_child(picker_button);
 
@@ -3279,7 +3279,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() {
 	erase_button = memnew(Button);
 	erase_button->set_flat(true);
 	erase_button->set_toggle_mode(true);
-	erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", KEY_E));
+	erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", Key::E));
 	erase_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport));
 	tools_settings->add_child(erase_button);
 
@@ -3897,8 +3897,8 @@ TileMapEditor::TileMapEditor() {
 	set_process_internal(true);
 
 	// Shortcuts.
-	ED_SHORTCUT("tiles_editor/select_next_layer", TTR("Select Next Tile Map Layer"), KEY_PAGEUP);
-	ED_SHORTCUT("tiles_editor/select_previous_layer", TTR("Select Previous Tile Map Layer"), KEY_PAGEDOWN);
+	ED_SHORTCUT("tiles_editor/select_next_layer", TTR("Select Next Tile Map Layer"), Key::PAGEUP);
+	ED_SHORTCUT("tiles_editor/select_previous_layer", TTR("Select Previous Tile Map Layer"), Key::PAGEDOWN);
 
 	// TileMap editor plugins
 	tile_map_editor_plugins.push_back(memnew(TileMapEditorTilesPlugin));

+ 8 - 8
editor/plugins/tiles/tile_set_atlas_source_editor.cpp

@@ -1142,7 +1142,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
 		Ref<InputEventMouseButton> mb = p_event;
 		if (mb.is_valid()) {
 			Vector2 mouse_local_pos = tile_atlas_control->get_local_mouse_position();
-			if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+			if (mb->get_button_index() == MouseButton::LEFT) {
 				if (mb->is_pressed()) {
 					// Left click pressed.
 					if (tools_button_group->get_pressed_button() == tool_setup_atlas_source_button) {
@@ -1288,7 +1288,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
 				alternative_tiles_control_unscaled->update();
 				tile_atlas_view->update();
 				return;
-			} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+			} else if (mb->get_button_index() == MouseButton::RIGHT) {
 				// Right click pressed.
 				if (mb->is_pressed()) {
 					drag_type = DRAG_TYPE_MAY_POPUP_MENU;
@@ -1427,7 +1427,7 @@ void TileSetAtlasSourceEditor::_end_dragging() {
 
 			// Determine if we clear, then add or remove to the selection.
 			bool add_to_selection = true;
-			if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+			if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 				Vector2i coords = tile_set_atlas_source->get_tile_at_coords(start_base_tiles_coords);
 				if (coords != TileSetSource::INVALID_ATLAS_COORDS) {
 					if (selection.has({ coords, 0 })) {
@@ -1892,7 +1892,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In
 		drag_type = DRAG_TYPE_NONE;
 
 		Vector2 mouse_local_pos = alternative_tiles_control->get_local_mouse_position();
-		if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+		if (mb->get_button_index() == MouseButton::LEFT) {
 			if (mb->is_pressed()) {
 				// Left click pressed.
 				if (tools_button_group->get_pressed_button() == tool_select_button) {
@@ -1908,7 +1908,7 @@ void TileSetAtlasSourceEditor::_tile_alternatives_control_gui_input(const Ref<In
 					_update_tile_id_label();
 				}
 			}
-		} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+		} else if (mb->get_button_index() == MouseButton::RIGHT) {
 			if (mb->is_pressed()) {
 				// Right click pressed
 				Vector3 tile = tile_atlas_view->get_alternative_tile_at_pos(mouse_local_pos);
@@ -2454,7 +2454,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
 	tools_settings_erase_button = memnew(Button);
 	tools_settings_erase_button->set_flat(true);
 	tools_settings_erase_button->set_toggle_mode(true);
-	tools_settings_erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", KEY_E));
+	tools_settings_erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", Key::E));
 	tools_settings_erase_button->set_shortcut_context(this);
 	tool_settings->add_child(tools_settings_erase_button);
 
@@ -2486,7 +2486,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
 	right_panel->add_child(tile_atlas_view);
 
 	base_tile_popup_menu = memnew(PopupMenu);
-	base_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), KEY_DELETE), TILE_DELETE);
+	base_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete", TTR("Delete"), Key::KEY_DELETE), TILE_DELETE);
 	base_tile_popup_menu->add_item(TTR("Create an Alternative Tile"), TILE_CREATE_ALTERNATIVE);
 	base_tile_popup_menu->connect("id_pressed", callable_mp(this, &TileSetAtlasSourceEditor::_menu_option));
 	tile_atlas_view->add_child(base_tile_popup_menu);
@@ -2509,7 +2509,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
 	tile_atlas_control_unscaled->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
 
 	alternative_tile_popup_menu = memnew(PopupMenu);
-	alternative_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete_tile", TTR("Delete"), KEY_DELETE), TILE_DELETE);
+	alternative_tile_popup_menu->add_shortcut(ED_SHORTCUT("tiles_editor/delete_tile", TTR("Delete"), Key::KEY_DELETE), TILE_DELETE);
 	alternative_tile_popup_menu->connect("id_pressed", callable_mp(this, &TileSetAtlasSourceEditor::_menu_option));
 	tile_atlas_view->add_child(alternative_tile_popup_menu);
 

+ 1 - 1
editor/plugins/version_control_editor_plugin.cpp

@@ -488,7 +488,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
 	commit_message->connect("text_changed", callable_mp(this, &VersionControlEditorPlugin::_update_commit_button));
 	commit_message->connect("gui_input", callable_mp(this, &VersionControlEditorPlugin::_commit_message_gui_input));
 	commit_box_vbc->add_child(commit_message);
-	ED_SHORTCUT("version_control/commit", TTR("Commit"), KEY_MASK_CMD | KEY_ENTER);
+	ED_SHORTCUT("version_control/commit", TTR("Commit"), KeyModifierMask::CMD | Key::ENTER);
 
 	commit_button = memnew(Button);
 	commit_button->set_text(TTR("Commit Changes"));

+ 2 - 2
editor/plugins/visual_shader_editor_plugin.cpp

@@ -3051,7 +3051,7 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseButton> mb = p_event;
 	VisualShader::Type type = get_current_shader_type();
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
 		selected_constants.clear();
 		selected_uniforms.clear();
 		selected_comment = -1;
@@ -3211,7 +3211,7 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos, VisualShaderNod
 
 void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
 	Ref<InputEventKey> ie = p_ie;
-	if (ie.is_valid() && (ie->get_keycode() == KEY_UP || ie->get_keycode() == KEY_DOWN || ie->get_keycode() == KEY_ENTER || ie->get_keycode() == KEY_KP_ENTER)) {
+	if (ie.is_valid() && (ie->get_keycode() == Key::UP || ie->get_keycode() == Key::DOWN || ie->get_keycode() == Key::ENTER || ie->get_keycode() == Key::KP_ENTER)) {
 		members->gui_input(ie);
 		node_filter->accept_event();
 	}

+ 15 - 15
editor/project_manager.cpp

@@ -1735,7 +1735,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
 	int clicked_index = p_hb->get_index();
 	const Item &clicked_project = _projects[clicked_index];
 
-	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		if (mb->is_shift_pressed() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) {
 			int anchor_index = -1;
 			for (int i = 0; i < _projects.size(); ++i) {
@@ -1899,7 +1899,7 @@ void ProjectManager::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 		// This is handled by the platform implementation on macOS,
 		// so only define the shortcut on other platforms
 #ifndef OSX_ENABLED
-		if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_Q)) {
+		if (k->get_keycode_with_modifiers() == (KeyModifierMask::CMD | Key::Q)) {
 			_dim_window();
 			get_tree()->quit();
 		}
@@ -1912,24 +1912,24 @@ void ProjectManager::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 		bool keycode_handled = true;
 
 		switch (k->get_keycode()) {
-			case KEY_ENTER: {
+			case Key::ENTER: {
 				_open_selected_projects_ask();
 			} break;
-			case KEY_HOME: {
+			case Key::HOME: {
 				if (_project_list->get_project_count() > 0) {
 					_project_list->select_project(0);
 					_update_project_buttons();
 				}
 
 			} break;
-			case KEY_END: {
+			case Key::END: {
 				if (_project_list->get_project_count() > 0) {
 					_project_list->select_project(_project_list->get_project_count() - 1);
 					_update_project_buttons();
 				}
 
 			} break;
-			case KEY_UP: {
+			case Key::UP: {
 				if (k->is_shift_pressed()) {
 					break;
 				}
@@ -1943,7 +1943,7 @@ void ProjectManager::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 
 				break;
 			}
-			case KEY_DOWN: {
+			case Key::DOWN: {
 				if (k->is_shift_pressed()) {
 					break;
 				}
@@ -1956,7 +1956,7 @@ void ProjectManager::unhandled_key_input(const Ref<InputEvent> &p_ev) {
 				}
 
 			} break;
-			case KEY_F: {
+			case Key::F: {
 				if (k->is_command_pressed()) {
 					this->search_box->grab_focus();
 				} else {
@@ -2520,19 +2520,19 @@ ProjectManager::ProjectManager() {
 
 		Button *create = memnew(Button);
 		create->set_text(TTR("New Project"));
-		create->set_shortcut(ED_SHORTCUT("project_manager/new_project", TTR("New Project"), KEY_MASK_CMD | KEY_N));
+		create->set_shortcut(ED_SHORTCUT("project_manager/new_project", TTR("New Project"), KeyModifierMask::CMD | Key::N));
 		create->connect("pressed", callable_mp(this, &ProjectManager::_new_project));
 		tree_vb->add_child(create);
 
 		Button *import = memnew(Button);
 		import->set_text(TTR("Import"));
-		import->set_shortcut(ED_SHORTCUT("project_manager/import_project", TTR("Import Project"), KEY_MASK_CMD | KEY_I));
+		import->set_shortcut(ED_SHORTCUT("project_manager/import_project", TTR("Import Project"), KeyModifierMask::CMD | Key::I));
 		import->connect("pressed", callable_mp(this, &ProjectManager::_import_project));
 		tree_vb->add_child(import);
 
 		Button *scan = memnew(Button);
 		scan->set_text(TTR("Scan"));
-		scan->set_shortcut(ED_SHORTCUT("project_manager/scan_projects", TTR("Scan Projects"), KEY_MASK_CMD | KEY_S));
+		scan->set_shortcut(ED_SHORTCUT("project_manager/scan_projects", TTR("Scan Projects"), KeyModifierMask::CMD | Key::S));
 		scan->connect("pressed", callable_mp(this, &ProjectManager::_scan_projects));
 		tree_vb->add_child(scan);
 
@@ -2540,26 +2540,26 @@ ProjectManager::ProjectManager() {
 
 		open_btn = memnew(Button);
 		open_btn->set_text(TTR("Edit"));
-		open_btn->set_shortcut(ED_SHORTCUT("project_manager/edit_project", TTR("Edit Project"), KEY_MASK_CMD | KEY_E));
+		open_btn->set_shortcut(ED_SHORTCUT("project_manager/edit_project", TTR("Edit Project"), KeyModifierMask::CMD | Key::E));
 		open_btn->connect("pressed", callable_mp(this, &ProjectManager::_open_selected_projects_ask));
 		tree_vb->add_child(open_btn);
 
 		run_btn = memnew(Button);
 		run_btn->set_text(TTR("Run"));
-		run_btn->set_shortcut(ED_SHORTCUT("project_manager/run_project", TTR("Run Project"), KEY_MASK_CMD | KEY_R));
+		run_btn->set_shortcut(ED_SHORTCUT("project_manager/run_project", TTR("Run Project"), KeyModifierMask::CMD | Key::R));
 		run_btn->connect("pressed", callable_mp(this, &ProjectManager::_run_project));
 		tree_vb->add_child(run_btn);
 
 		rename_btn = memnew(Button);
 		rename_btn->set_text(TTR("Rename"));
 		// The F2 shortcut isn't overridden with Enter on macOS as Enter is already used to edit a project.
-		rename_btn->set_shortcut(ED_SHORTCUT("project_manager/rename_project", TTR("Rename Project"), KEY_F2));
+		rename_btn->set_shortcut(ED_SHORTCUT("project_manager/rename_project", TTR("Rename Project"), Key::F2));
 		rename_btn->connect("pressed", callable_mp(this, &ProjectManager::_rename_project));
 		tree_vb->add_child(rename_btn);
 
 		erase_btn = memnew(Button);
 		erase_btn->set_text(TTR("Remove"));
-		erase_btn->set_shortcut(ED_SHORTCUT("project_manager/remove_project", TTR("Remove Project"), KEY_DELETE));
+		erase_btn->set_shortcut(ED_SHORTCUT("project_manager/remove_project", TTR("Remove Project"), Key::KEY_DELETE));
 		erase_btn->connect("pressed", callable_mp(this, &ProjectManager::_erase_project));
 		tree_vb->add_child(erase_btn);
 

+ 2 - 2
editor/property_editor.cpp

@@ -1343,7 +1343,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
 void CustomPropertyEditor::_drag_easing(const Ref<InputEvent> &p_ev) {
 	Ref<InputEventMouseMotion> mm = p_ev;
 
-	if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
+	if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) {
 		float rel = mm->get_relative().x;
 		if (rel == 0) {
 			return;
@@ -1628,7 +1628,7 @@ real_t CustomPropertyEditor::_parse_real_expression(String text) {
 }
 
 void CustomPropertyEditor::_emit_changed_whole_or_field() {
-	if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (!Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		emit_signal(SNAME("variant_changed"));
 	} else {
 		emit_signal(SNAME("variant_field_changed"), field_names[focused_value_editor]);

+ 4 - 4
editor/property_selector.cpp

@@ -44,10 +44,10 @@ void PropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
 
 	if (k.is_valid()) {
 		switch (k->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				search_options->gui_input(k);
 				search_box->accept_event();
 

+ 4 - 4
editor/quick_open.cpp

@@ -167,10 +167,10 @@ void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
 	Ref<InputEventKey> k = p_ie;
 	if (k.is_valid()) {
 		switch (k->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				search_options->gui_input(k);
 				search_box->accept_event();
 

+ 19 - 19
editor/scene_tree_dock.cpp

@@ -70,7 +70,7 @@ void SceneTreeDock::input(const Ref<InputEvent> &p_event) {
 
 	Ref<InputEventMouseButton> mb = p_event;
 
-	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+	if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
 		restore_script_editor_on_drag = false; //lost chance
 	}
 }
@@ -1195,7 +1195,7 @@ void SceneTreeDock::_node_collapsed(Object *p_obj) {
 		return;
 	}
 
-	if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+	if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 		_set_collapsed_recursive(ti, ti->is_collapsed());
 	}
 }
@@ -2618,7 +2618,7 @@ void SceneTreeDock::_nodes_dragged(Array p_nodes, NodePath p_to, int p_type) {
 	int to_pos = -1;
 
 	_normalize_drop(to_node, to_pos, p_type);
-	_do_reparent(to_node, to_pos, nodes, !Input::get_singleton()->is_key_pressed(KEY_SHIFT));
+	_do_reparent(to_node, to_pos, nodes, !Input::get_singleton()->is_key_pressed(Key::SHIFT));
 }
 
 void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
@@ -2829,7 +2829,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
 
 	if (profile_allow_editing) {
 		menu->add_separator();
-		menu->add_icon_shortcut(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE);
+		menu->add_icon_shortcut(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), Key::KEY_DELETE), TOOL_ERASE);
 	}
 	menu->set_size(Size2(1, 1));
 	menu->set_position(p_menu_pos);
@@ -3229,32 +3229,32 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
 	HBoxContainer *filter_hbc = memnew(HBoxContainer);
 	filter_hbc->add_theme_constant_override("separate", 0);
 
-	ED_SHORTCUT("scene_tree/rename", TTR("Rename"), KEY_F2);
-	ED_SHORTCUT_OVERRIDE("scene_tree/rename", "macos", KEY_ENTER);
+	ED_SHORTCUT("scene_tree/rename", TTR("Rename"), Key::F2);
+	ED_SHORTCUT_OVERRIDE("scene_tree/rename", "macos", Key::ENTER);
 
-	ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KEY_MASK_SHIFT | KEY_F2);
-	ED_SHORTCUT_OVERRIDE("scene_tree/batch_rename", "macos", KEY_MASK_SHIFT | KEY_ENTER);
+	ED_SHORTCUT("scene_tree/batch_rename", TTR("Batch Rename"), KeyModifierMask::SHIFT | Key::F2);
+	ED_SHORTCUT_OVERRIDE("scene_tree/batch_rename", "macos", KeyModifierMask::SHIFT | Key::ENTER);
 
-	ED_SHORTCUT("scene_tree/add_child_node", TTR("Add Child Node"), KEY_MASK_CMD | KEY_A);
-	ED_SHORTCUT("scene_tree/instance_scene", TTR("Instantiate Child Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_A);
+	ED_SHORTCUT("scene_tree/add_child_node", TTR("Add Child Node"), KeyModifierMask::CMD | Key::A);
+	ED_SHORTCUT("scene_tree/instance_scene", TTR("Instantiate Child Scene"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::A);
 	ED_SHORTCUT("scene_tree/expand_collapse_all", TTR("Expand/Collapse All"));
-	ED_SHORTCUT("scene_tree/cut_node", TTR("Cut"), KEY_MASK_CMD | KEY_X);
-	ED_SHORTCUT("scene_tree/copy_node", TTR("Copy"), KEY_MASK_CMD | KEY_C);
-	ED_SHORTCUT("scene_tree/paste_node", TTR("Paste"), KEY_MASK_CMD | KEY_V);
+	ED_SHORTCUT("scene_tree/cut_node", TTR("Cut"), KeyModifierMask::CMD | Key::X);
+	ED_SHORTCUT("scene_tree/copy_node", TTR("Copy"), KeyModifierMask::CMD | Key::C);
+	ED_SHORTCUT("scene_tree/paste_node", TTR("Paste"), KeyModifierMask::CMD | Key::V);
 	ED_SHORTCUT("scene_tree/change_node_type", TTR("Change Type"));
 	ED_SHORTCUT("scene_tree/attach_script", TTR("Attach Script"));
 	ED_SHORTCUT("scene_tree/extend_script", TTR("Extend Script"));
 	ED_SHORTCUT("scene_tree/detach_script", TTR("Detach Script"));
-	ED_SHORTCUT("scene_tree/move_up", TTR("Move Up"), KEY_MASK_CMD | KEY_UP);
-	ED_SHORTCUT("scene_tree/move_down", TTR("Move Down"), KEY_MASK_CMD | KEY_DOWN);
-	ED_SHORTCUT("scene_tree/duplicate", TTR("Duplicate"), KEY_MASK_CMD | KEY_D);
+	ED_SHORTCUT("scene_tree/move_up", TTR("Move Up"), KeyModifierMask::CMD | Key::UP);
+	ED_SHORTCUT("scene_tree/move_down", TTR("Move Down"), KeyModifierMask::CMD | Key::DOWN);
+	ED_SHORTCUT("scene_tree/duplicate", TTR("Duplicate"), KeyModifierMask::CMD | Key::D);
 	ED_SHORTCUT("scene_tree/reparent", TTR("Reparent"));
 	ED_SHORTCUT("scene_tree/reparent_to_new_node", TTR("Reparent to New Node"));
 	ED_SHORTCUT("scene_tree/make_root", TTR("Make Scene Root"));
 	ED_SHORTCUT("scene_tree/save_branch_as_scene", TTR("Save Branch as Scene"));
-	ED_SHORTCUT("scene_tree/copy_node_path", TTR("Copy Node Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C);
-	ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KEY_MASK_SHIFT | KEY_DELETE);
-	ED_SHORTCUT("scene_tree/delete", TTR("Delete"), KEY_DELETE);
+	ED_SHORTCUT("scene_tree/copy_node_path", TTR("Copy Node Path"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::C);
+	ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KeyModifierMask::SHIFT | Key::KEY_DELETE);
+	ED_SHORTCUT("scene_tree/delete", TTR("Delete"), Key::KEY_DELETE);
 
 	button_add = memnew(Button);
 	button_add->set_flat(true);

+ 1 - 1
editor/settings_config_dialog.cpp

@@ -164,7 +164,7 @@ void EditorSettingsDialog::unhandled_input(const Ref<InputEvent> &p_event) {
 			handled = true;
 		}
 
-		if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
+		if (k->get_keycode_with_modifiers() == (KeyModifierMask::CMD | Key::F)) {
 			_focus_current_search_box();
 			handled = true;
 		}

+ 31 - 31
modules/gridmap/grid_map_editor_plugin.cpp

@@ -611,13 +611,13 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 	Ref<InputEventMouseButton> mb = p_event;
 
 	if (mb.is_valid()) {
-		if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && (mb->is_command_pressed() || mb->is_shift_pressed())) {
+		if (mb->get_button_index() == MouseButton::WHEEL_UP && (mb->is_command_pressed() || mb->is_shift_pressed())) {
 			if (mb->is_pressed()) {
 				floor->set_value(floor->get_value() + mb->get_factor());
 			}
 
 			return EditorPlugin::AFTER_GUI_INPUT_STOP; // Eaten.
-		} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && (mb->is_command_pressed() || mb->is_shift_pressed())) {
+		} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN && (mb->is_command_pressed() || mb->is_shift_pressed())) {
 			if (mb->is_pressed()) {
 				floor->set_value(floor->get_value() - mb->get_factor());
 			}
@@ -628,7 +628,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 			Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
 			if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->is_alt_pressed()) {
 				input_action = INPUT_NONE;
-			} else if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
+			} else if (mb->get_button_index() == MouseButton::LEFT) {
 				bool can_edit = (node && node->get_mesh_library().is_valid());
 				if (input_action == INPUT_PASTE) {
 					_do_paste();
@@ -643,7 +643,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 					input_action = INPUT_PAINT;
 					set_items.clear();
 				}
-			} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
+			} else if (mb->get_button_index() == MouseButton::RIGHT) {
 				if (input_action == INPUT_PASTE) {
 					_clear_clipboard_data();
 					input_action = INPUT_NONE;
@@ -665,7 +665,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 			}
 			return EditorPlugin::AFTER_GUI_INPUT_PASS;
 		} else {
-			if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) {
+			if ((mb->get_button_index() == MouseButton::RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MouseButton::LEFT && input_action == INPUT_PAINT)) {
 				if (set_items.size()) {
 					undo_redo->create_action(TTR("GridMap Paint"));
 					for (const SetItem &si : set_items) {
@@ -687,19 +687,19 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 				return EditorPlugin::AFTER_GUI_INPUT_PASS;
 			}
 
-			if (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_SELECT) {
+			if (mb->get_button_index() == MouseButton::LEFT && input_action == INPUT_SELECT) {
 				undo_redo->create_action(TTR("GridMap Selection"));
 				undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
 				undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
 				undo_redo->commit_action();
 			}
 
-			if (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action != INPUT_NONE) {
+			if (mb->get_button_index() == MouseButton::LEFT && input_action != INPUT_NONE) {
 				set_items.clear();
 				input_action = INPUT_NONE;
 				return EditorPlugin::AFTER_GUI_INPUT_STOP;
 			}
-			if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
+			if (mb->get_button_index() == MouseButton::RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
 				input_action = INPUT_NONE;
 				return EditorPlugin::AFTER_GUI_INPUT_STOP;
 			}
@@ -719,7 +719,7 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 
 	if (k.is_valid()) {
 		if (k->is_pressed()) {
-			if (k->get_keycode() == KEY_ESCAPE) {
+			if (k->get_keycode() == Key::ESCAPE) {
 				if (input_action == INPUT_PASTE) {
 					_clear_clipboard_data();
 					input_action = INPUT_NONE;
@@ -738,12 +738,12 @@ EditorPlugin::AfterGUIInput GridMapEditor::forward_spatial_input_event(Camera3D
 			}
 
 			if (k->is_shift_pressed() && selection.active && input_action != INPUT_PASTE) {
-				if (k->get_keycode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_PREV_LEVEL))) {
+				if (k->get_keycode() == (Key)options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_PREV_LEVEL))) {
 					selection.click[edit_axis]--;
 					_validate_selection();
 					return EditorPlugin::AFTER_GUI_INPUT_STOP;
 				}
-				if (k->get_keycode() == options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_NEXT_LEVEL))) {
+				if (k->get_keycode() == (Key)options->get_popup()->get_item_accelerator(options->get_popup()->get_item_index(MENU_OPTION_NEXT_LEVEL))) {
 					selection.click[edit_axis]++;
 					_validate_selection();
 					return EditorPlugin::AFTER_GUI_INPUT_STOP;
@@ -804,7 +804,7 @@ void GridMapEditor::_text_changed(const String &p_text) {
 void GridMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
 	const Ref<InputEventKey> k = p_ie;
 
-	if (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_PAGEUP || k->get_keycode() == KEY_PAGEDOWN)) {
+	if (k.is_valid() && (k->get_keycode() == Key::UP || k->get_keycode() == Key::DOWN || k->get_keycode() == Key::PAGEUP || k->get_keycode() == Key::PAGEDOWN)) {
 		// Forward the key input to the ItemList so it can be scrolled
 		mesh_library_palette->gui_input(k);
 		search_box->accept_event();
@@ -816,11 +816,11 @@ void GridMapEditor::_mesh_library_palette_input(const Ref<InputEvent> &p_ie) {
 
 	// Zoom in/out using Ctrl + mouse wheel
 	if (mb.is_valid() && mb->is_pressed() && mb->is_command_pressed()) {
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) {
 			size_slider->set_value(size_slider->get_value() + 0.2);
 		}
 
-		if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
+		if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) {
 			size_slider->set_value(size_slider->get_value() - 0.2);
 		}
 	}
@@ -1097,7 +1097,7 @@ void GridMapEditor::_notification(int p_what) {
 				// Simulate mouse released event to stop drawing when editor focus exists.
 				Ref<InputEventMouseButton> release;
 				release.instantiate();
-				release->set_button_index(MOUSE_BUTTON_LEFT);
+				release->set_button_index(MouseButton::LEFT);
 				forward_spatial_input_event(nullptr, release);
 			}
 		} break;
@@ -1188,33 +1188,33 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
 	spatial_editor_hb->hide();
 
 	options->set_text(TTR("Grid Map"));
-	options->get_popup()->add_item(TTR("Previous Floor"), MENU_OPTION_PREV_LEVEL, KEY_Q);
-	options->get_popup()->add_item(TTR("Next Floor"), MENU_OPTION_NEXT_LEVEL, KEY_E);
+	options->get_popup()->add_item(TTR("Previous Floor"), MENU_OPTION_PREV_LEVEL, Key::Q);
+	options->get_popup()->add_item(TTR("Next Floor"), MENU_OPTION_NEXT_LEVEL, Key::E);
 	options->get_popup()->add_separator();
 	options->get_popup()->add_radio_check_item(TTR("Clip Disabled"), MENU_OPTION_CLIP_DISABLED);
 	options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_CLIP_DISABLED), true);
 	options->get_popup()->add_radio_check_item(TTR("Clip Above"), MENU_OPTION_CLIP_ABOVE);
 	options->get_popup()->add_radio_check_item(TTR("Clip Below"), MENU_OPTION_CLIP_BELOW);
 	options->get_popup()->add_separator();
-	options->get_popup()->add_radio_check_item(TTR("Edit X Axis"), MENU_OPTION_X_AXIS, KEY_Z);
-	options->get_popup()->add_radio_check_item(TTR("Edit Y Axis"), MENU_OPTION_Y_AXIS, KEY_X);
-	options->get_popup()->add_radio_check_item(TTR("Edit Z Axis"), MENU_OPTION_Z_AXIS, KEY_C);
+	options->get_popup()->add_radio_check_item(TTR("Edit X Axis"), MENU_OPTION_X_AXIS, Key::Z);
+	options->get_popup()->add_radio_check_item(TTR("Edit Y Axis"), MENU_OPTION_Y_AXIS, Key::X);
+	options->get_popup()->add_radio_check_item(TTR("Edit Z Axis"), MENU_OPTION_Z_AXIS, Key::C);
 	options->get_popup()->set_item_checked(options->get_popup()->get_item_index(MENU_OPTION_Y_AXIS), true);
 	options->get_popup()->add_separator();
-	options->get_popup()->add_item(TTR("Cursor Rotate X"), MENU_OPTION_CURSOR_ROTATE_X, KEY_A);
-	options->get_popup()->add_item(TTR("Cursor Rotate Y"), MENU_OPTION_CURSOR_ROTATE_Y, KEY_S);
-	options->get_popup()->add_item(TTR("Cursor Rotate Z"), MENU_OPTION_CURSOR_ROTATE_Z, KEY_D);
-	options->get_popup()->add_item(TTR("Cursor Back Rotate X"), MENU_OPTION_CURSOR_BACK_ROTATE_X, KEY_MASK_SHIFT + KEY_A);
-	options->get_popup()->add_item(TTR("Cursor Back Rotate Y"), MENU_OPTION_CURSOR_BACK_ROTATE_Y, KEY_MASK_SHIFT + KEY_S);
-	options->get_popup()->add_item(TTR("Cursor Back Rotate Z"), MENU_OPTION_CURSOR_BACK_ROTATE_Z, KEY_MASK_SHIFT + KEY_D);
-	options->get_popup()->add_item(TTR("Cursor Clear Rotation"), MENU_OPTION_CURSOR_CLEAR_ROTATION, KEY_W);
+	options->get_popup()->add_item(TTR("Cursor Rotate X"), MENU_OPTION_CURSOR_ROTATE_X, Key::A);
+	options->get_popup()->add_item(TTR("Cursor Rotate Y"), MENU_OPTION_CURSOR_ROTATE_Y, Key::S);
+	options->get_popup()->add_item(TTR("Cursor Rotate Z"), MENU_OPTION_CURSOR_ROTATE_Z, Key::D);
+	options->get_popup()->add_item(TTR("Cursor Back Rotate X"), MENU_OPTION_CURSOR_BACK_ROTATE_X, KeyModifierMask::SHIFT + Key::A);
+	options->get_popup()->add_item(TTR("Cursor Back Rotate Y"), MENU_OPTION_CURSOR_BACK_ROTATE_Y, KeyModifierMask::SHIFT + Key::S);
+	options->get_popup()->add_item(TTR("Cursor Back Rotate Z"), MENU_OPTION_CURSOR_BACK_ROTATE_Z, KeyModifierMask::SHIFT + Key::D);
+	options->get_popup()->add_item(TTR("Cursor Clear Rotation"), MENU_OPTION_CURSOR_CLEAR_ROTATION, Key::W);
 	options->get_popup()->add_separator();
 	options->get_popup()->add_check_item(TTR("Paste Selects"), MENU_OPTION_PASTE_SELECTS);
 	options->get_popup()->add_separator();
-	options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KEY_MASK_CTRL + KEY_C);
-	options->get_popup()->add_item(TTR("Cut Selection"), MENU_OPTION_SELECTION_CUT, KEY_MASK_CTRL + KEY_X);
-	options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, KEY_DELETE);
-	options->get_popup()->add_item(TTR("Fill Selection"), MENU_OPTION_SELECTION_FILL, KEY_MASK_CTRL + KEY_F);
+	options->get_popup()->add_item(TTR("Duplicate Selection"), MENU_OPTION_SELECTION_DUPLICATE, KeyModifierMask::CTRL + Key::C);
+	options->get_popup()->add_item(TTR("Cut Selection"), MENU_OPTION_SELECTION_CUT, KeyModifierMask::CTRL + Key::X);
+	options->get_popup()->add_item(TTR("Clear Selection"), MENU_OPTION_SELECTION_CLEAR, Key::KEY_DELETE);
+	options->get_popup()->add_item(TTR("Fill Selection"), MENU_OPTION_SELECTION_FILL, KeyModifierMask::CTRL + Key::F);
 
 	options->get_popup()->add_separator();
 	options->get_popup()->add_item(TTR("Settings..."), MENU_OPTION_GRIDMAP_SETTINGS);

+ 1 - 1
modules/mono/csharp_script.cpp

@@ -1355,7 +1355,7 @@ void CSharpLanguage::_editor_init_callback() {
 
 	// Enable it as a plugin
 	EditorNode::add_editor_plugin(godotsharp_editor);
-	ED_SHORTCUT("mono/build_solution", TTR("Build Solution"), KEY_MASK_ALT | KEY_B);
+	ED_SHORTCUT("mono/build_solution", TTR("Build Solution"), KeyModifierMask::ALT | Key::B);
 	godotsharp_editor->enable_plugin();
 
 	get_singleton()->godotsharp_editor = godotsharp_editor;

+ 2 - 2
modules/mono/utils/mono_reg_utils.cpp

@@ -58,10 +58,10 @@ REGSAM _get_bitness_sam() {
 }
 
 LONG _RegOpenKey(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult) {
-	LONG res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ, phkResult);
+	LONG res = RegOpenKeyExW(hKey, lpSubKey, 0, Key::READ, phkResult);
 
 	if (res != ERROR_SUCCESS)
-		res = RegOpenKeyExW(hKey, lpSubKey, 0, KEY_READ | _get_bitness_sam(), phkResult);
+		res = RegOpenKeyExW(hKey, lpSubKey, 0, Key::READ | _get_bitness_sam(), phkResult);
 
 	return res;
 }

+ 22 - 22
modules/visual_script/editor/visual_script_editor.cpp

@@ -1172,9 +1172,9 @@ void VisualScriptEditor::_member_selected() {
 
 	if (ti->get_parent() == members->get_root()->get_first_child()) {
 #ifdef OSX_ENABLED
-		bool held_ctrl = Input::get_singleton()->is_key_pressed(KEY_META);
+		bool held_ctrl = Input::get_singleton()->is_key_pressed(Key::META);
 #else
-		bool held_ctrl = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+		bool held_ctrl = Input::get_singleton()->is_key_pressed(Key::CTRL);
 #endif
 		if (held_ctrl) {
 			ERR_FAIL_COND(!script->has_function(selected));
@@ -1952,7 +1952,7 @@ void VisualScriptEditor::input(const Ref<InputEvent> &p_event) {
 void VisualScriptEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEventMouseButton> key = p_event;
 
-	if (key.is_valid() && key->is_pressed() && key->get_button_mask() == MOUSE_BUTTON_RIGHT) {
+	if (key.is_valid() && key->is_pressed() && key->get_button_mask() == MouseButton::RIGHT) {
 		saved_position = graph->get_local_mouse_position();
 
 		Point2 gpos = Input::get_singleton()->get_mouse_position();
@@ -2049,7 +2049,7 @@ void VisualScriptEditor::_fn_name_box_input(const Ref<InputEvent> &p_event) {
 	}
 
 	Ref<InputEventKey> key = p_event;
-	if (key.is_valid() && key->is_pressed() && key->get_keycode() == KEY_ENTER) {
+	if (key.is_valid() && key->is_pressed() && key->get_keycode() == Key::ENTER) {
 		function_name_edit->hide();
 		_rename_function(selected, function_name_box->get_text());
 		function_name_box->clear();
@@ -2108,7 +2108,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
 						String(d["type"]) == "nodes")) {
 			if (String(d["type"]) == "obj_property") {
 #ifdef OSX_ENABLED
-				const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Getter. Hold Shift to drop a generic signature."), find_keycode_name(KEY_META)));
+				const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Getter. Hold Shift to drop a generic signature."), find_keycode_name(Key::META)));
 #else
 				const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a Getter. Hold Shift to drop a generic signature."));
 #endif
@@ -2116,7 +2116,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
 
 			if (String(d["type"]) == "nodes") {
 #ifdef OSX_ENABLED
-				const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a simple reference to the node."), find_keycode_name(KEY_META)));
+				const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a simple reference to the node."), find_keycode_name(Key::META)));
 #else
 				const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a simple reference to the node."));
 #endif
@@ -2124,7 +2124,7 @@ bool VisualScriptEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
 
 			if (String(d["type"]) == "visual_script_variable_drag") {
 #ifdef OSX_ENABLED
-				const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Variable Setter."), find_keycode_name(KEY_META)));
+				const_cast<VisualScriptEditor *>(this)->_show_hint(vformat(TTR("Hold %s to drop a Variable Setter."), find_keycode_name(Key::META)));
 #else
 				const_cast<VisualScriptEditor *>(this)->_show_hint(TTR("Hold Ctrl to drop a Variable Setter."));
 #endif
@@ -2187,9 +2187,9 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
 
 	if (String(d["type"]) == "visual_script_variable_drag") {
 #ifdef OSX_ENABLED
-		bool use_set = Input::get_singleton()->is_key_pressed(KEY_META);
+		bool use_set = Input::get_singleton()->is_key_pressed(Key::META);
 #else
-		bool use_set = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+		bool use_set = Input::get_singleton()->is_key_pressed(Key::CTRL);
 #endif
 		Vector2 pos = _get_pos_in_graph(p_point);
 
@@ -2296,9 +2296,9 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
 
 	if (String(d["type"]) == "files") {
 #ifdef OSX_ENABLED
-		bool use_preload = Input::get_singleton()->is_key_pressed(KEY_META);
+		bool use_preload = Input::get_singleton()->is_key_pressed(Key::META);
 #else
-		bool use_preload = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+		bool use_preload = Input::get_singleton()->is_key_pressed(Key::CTRL);
 #endif
 		Vector2 pos = _get_pos_in_graph(p_point);
 
@@ -2359,9 +2359,9 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
 		}
 
 #ifdef OSX_ENABLED
-		bool use_node = Input::get_singleton()->is_key_pressed(KEY_META);
+		bool use_node = Input::get_singleton()->is_key_pressed(Key::META);
 #else
-		bool use_node = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+		bool use_node = Input::get_singleton()->is_key_pressed(Key::CTRL);
 #endif
 
 		Array nodes = d["nodes"];
@@ -2409,7 +2409,7 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
 	if (String(d["type"]) == "obj_property") {
 		Node *sn = _find_script_node(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root(), script);
 
-		if (!sn && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+		if (!sn && !Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 			EditorNode::get_singleton()->show_warning(vformat(TTR("Can't drop properties because script '%s' is not used in this scene.\nDrop holding 'Shift' to just copy the signature."), get_name()));
 			return;
 		}
@@ -2424,12 +2424,12 @@ void VisualScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
 		Vector2 pos = _get_pos_in_graph(p_point);
 
 #ifdef OSX_ENABLED
-		bool use_get = Input::get_singleton()->is_key_pressed(KEY_META);
+		bool use_get = Input::get_singleton()->is_key_pressed(Key::META);
 #else
-		bool use_get = Input::get_singleton()->is_key_pressed(KEY_CTRL);
+		bool use_get = Input::get_singleton()->is_key_pressed(Key::CTRL);
 #endif
 
-		if (!node || Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
+		if (!node || Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
 			if (use_get) {
 				undo_redo->create_action(TTR("Add Getter Property"));
 			} else {
@@ -4554,11 +4554,11 @@ void VisualScriptEditor::free_clipboard() {
 static void register_editor_callback() {
 	ScriptEditor::register_create_script_editor_function(create_editor);
 
-	ED_SHORTCUT("visual_script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9);
-	ED_SHORTCUT("visual_script_editor/find_node_type", TTR("Find Node Type"), KEY_MASK_CMD + KEY_F);
-	ED_SHORTCUT("visual_script_editor/create_function", TTR("Make Function"), KEY_MASK_CMD + KEY_G);
-	ED_SHORTCUT("visual_script_editor/refresh_nodes", TTR("Refresh Graph"), KEY_MASK_CMD + KEY_R);
-	ED_SHORTCUT("visual_script_editor/edit_member", TTR("Edit Member"), KEY_MASK_CMD + KEY_E);
+	ED_SHORTCUT("visual_script_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), Key::F9);
+	ED_SHORTCUT("visual_script_editor/find_node_type", TTR("Find Node Type"), KeyModifierMask::CMD + Key::F);
+	ED_SHORTCUT("visual_script_editor/create_function", TTR("Make Function"), KeyModifierMask::CMD + Key::G);
+	ED_SHORTCUT("visual_script_editor/refresh_nodes", TTR("Refresh Graph"), KeyModifierMask::CMD + Key::R);
+	ED_SHORTCUT("visual_script_editor/edit_member", TTR("Edit Member"), KeyModifierMask::CMD + Key::E);
 }
 
 void VisualScriptEditor::register_editor() {

+ 4 - 4
modules/visual_script/editor/visual_script_property_selector.cpp

@@ -51,10 +51,10 @@ void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
 
 	if (k.is_valid()) {
 		switch (k->get_keycode()) {
-			case KEY_UP:
-			case KEY_DOWN:
-			case KEY_PAGEUP:
-			case KEY_PAGEDOWN: {
+			case Key::UP:
+			case Key::DOWN:
+			case Key::PAGEUP:
+			case Key::PAGEDOWN: {
 				search_options->gui_input(k);
 				search_box->accept_event();
 

+ 37 - 37
platform/android/android_input_handler.cpp

@@ -45,7 +45,7 @@ void AndroidInputHandler::process_joy_event(AndroidInputHandler::JoypadEvent p_e
 			Input::get_singleton()->joy_axis(p_event.device, (JoyAxis)p_event.index, value);
 			break;
 		case JOY_EVENT_HAT:
-			Input::get_singleton()->joy_hat(p_event.device, (HatMask)p_event.hat);
+			Input::get_singleton()->joy_hat(p_event.device, p_event.hat);
 			break;
 		default:
 			return;
@@ -82,37 +82,37 @@ void AndroidInputHandler::process_key_event(int p_keycode, int p_scancode, int p
 	Ref<InputEventKey> ev;
 	ev.instantiate();
 	int val = unicode;
-	int keycode = android_get_keysym(p_keycode);
-	int phy_keycode = android_get_keysym(p_scancode);
+	Key keycode = android_get_keysym(p_keycode);
+	Key phy_keycode = android_get_keysym(p_scancode);
 
-	if (keycode == KEY_SHIFT) {
+	if (keycode == Key::SHIFT) {
 		shift_mem = p_pressed;
 	}
-	if (keycode == KEY_ALT) {
+	if (keycode == Key::ALT) {
 		alt_mem = p_pressed;
 	}
-	if (keycode == KEY_CTRL) {
+	if (keycode == Key::CTRL) {
 		control_mem = p_pressed;
 	}
-	if (keycode == KEY_META) {
+	if (keycode == Key::META) {
 		meta_mem = p_pressed;
 	}
 
-	ev->set_keycode((Key)keycode);
-	ev->set_physical_keycode((Key)phy_keycode);
+	ev->set_keycode(keycode);
+	ev->set_physical_keycode(phy_keycode);
 	ev->set_unicode(val);
 	ev->set_pressed(p_pressed);
 
 	_set_key_modifier_state(ev);
 
 	if (val == '\n') {
-		ev->set_keycode(KEY_ENTER);
+		ev->set_keycode(Key::ENTER);
 	} else if (val == 61448) {
-		ev->set_keycode(KEY_BACKSPACE);
-		ev->set_unicode(KEY_BACKSPACE);
+		ev->set_keycode(Key::BACKSPACE);
+		ev->set_unicode((char32_t)Key::BACKSPACE);
 	} else if (val == 61453) {
-		ev->set_keycode(KEY_ENTER);
-		ev->set_unicode(KEY_ENTER);
+		ev->set_keycode(Key::ENTER);
+		ev->set_unicode((char32_t)Key::ENTER);
 	} else if (p_keycode == 4) {
 		if (DisplayServerAndroid *dsa = Object::cast_to<DisplayServerAndroid>(DisplayServer::get_singleton())) {
 			dsa->send_window_event(DisplayServer::WINDOW_EVENT_GO_BACK_REQUEST, true);
@@ -305,15 +305,15 @@ void AndroidInputHandler::process_mouse_event(int input_device, int event_action
 			ev->set_pressed(true);
 			buttons_state = event_buttons_mask;
 			if (event_vertical_factor > 0) {
-				_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_UP, event_vertical_factor);
+				_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_UP, event_vertical_factor);
 			} else if (event_vertical_factor < 0) {
-				_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_DOWN, -event_vertical_factor);
+				_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_DOWN, -event_vertical_factor);
 			}
 
 			if (event_horizontal_factor > 0) {
-				_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_RIGHT, event_horizontal_factor);
+				_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_RIGHT, event_horizontal_factor);
 			} else if (event_horizontal_factor < 0) {
-				_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_LEFT, -event_horizontal_factor);
+				_wheel_button_click(event_buttons_mask, ev, MouseButton::WHEEL_LEFT, -event_horizontal_factor);
 			}
 		} break;
 	}
@@ -323,7 +323,7 @@ void AndroidInputHandler::_wheel_button_click(MouseButton event_buttons_mask, co
 	Ref<InputEventMouseButton> evd = ev->duplicate();
 	_set_key_modifier_state(evd);
 	evd->set_button_index(wheel_button);
-	evd->set_button_mask(MouseButton(event_buttons_mask ^ (1 << (wheel_button - 1))));
+	evd->set_button_mask(MouseButton(event_buttons_mask ^ mouse_button_to_mask(wheel_button)));
 	evd->set_factor(factor);
 	Input::get_singleton()->parse_input_event(evd);
 	Ref<InputEventMouseButton> evdd = evd->duplicate();
@@ -339,7 +339,7 @@ void AndroidInputHandler::process_double_tap(int event_android_button_mask, Poin
 	_set_key_modifier_state(ev);
 	ev->set_position(p_pos);
 	ev->set_global_position(p_pos);
-	ev->set_pressed(event_button_mask != 0);
+	ev->set_pressed(event_button_mask != MouseButton::NONE);
 	ev->set_button_index(_button_index_from_mask(event_button_mask));
 	ev->set_button_mask(event_button_mask);
 	ev->set_double_click(true);
@@ -348,37 +348,37 @@ void AndroidInputHandler::process_double_tap(int event_android_button_mask, Poin
 
 MouseButton AndroidInputHandler::_button_index_from_mask(MouseButton button_mask) {
 	switch (button_mask) {
-		case MOUSE_BUTTON_MASK_LEFT:
-			return MOUSE_BUTTON_LEFT;
-		case MOUSE_BUTTON_MASK_RIGHT:
-			return MOUSE_BUTTON_RIGHT;
-		case MOUSE_BUTTON_MASK_MIDDLE:
-			return MOUSE_BUTTON_MIDDLE;
-		case MOUSE_BUTTON_MASK_XBUTTON1:
-			return MOUSE_BUTTON_XBUTTON1;
-		case MOUSE_BUTTON_MASK_XBUTTON2:
-			return MOUSE_BUTTON_XBUTTON2;
+		case MouseButton::MASK_LEFT:
+			return MouseButton::LEFT;
+		case MouseButton::MASK_RIGHT:
+			return MouseButton::RIGHT;
+		case MouseButton::MASK_MIDDLE:
+			return MouseButton::MIDDLE;
+		case MouseButton::MASK_XBUTTON1:
+			return MouseButton::MB_XBUTTON1;
+		case MouseButton::MASK_XBUTTON2:
+			return MouseButton::MB_XBUTTON2;
 		default:
-			return MOUSE_BUTTON_NONE;
+			return MouseButton::NONE;
 	}
 }
 
 MouseButton AndroidInputHandler::_android_button_mask_to_godot_button_mask(int android_button_mask) {
-	MouseButton godot_button_mask = MOUSE_BUTTON_NONE;
+	MouseButton godot_button_mask = MouseButton::NONE;
 	if (android_button_mask & AMOTION_EVENT_BUTTON_PRIMARY) {
-		godot_button_mask |= MOUSE_BUTTON_MASK_LEFT;
+		godot_button_mask |= MouseButton::MASK_LEFT;
 	}
 	if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) {
-		godot_button_mask |= MOUSE_BUTTON_MASK_RIGHT;
+		godot_button_mask |= MouseButton::MASK_RIGHT;
 	}
 	if (android_button_mask & AMOTION_EVENT_BUTTON_TERTIARY) {
-		godot_button_mask |= MOUSE_BUTTON_MASK_MIDDLE;
+		godot_button_mask |= MouseButton::MASK_MIDDLE;
 	}
 	if (android_button_mask & AMOTION_EVENT_BUTTON_BACK) {
-		godot_button_mask |= MOUSE_BUTTON_MASK_XBUTTON1;
+		godot_button_mask |= MouseButton::MASK_XBUTTON1;
 	}
 	if (android_button_mask & AMOTION_EVENT_BUTTON_FORWARD) {
-		godot_button_mask |= MOUSE_BUTTON_MASK_XBUTTON2;
+		godot_button_mask |= MouseButton::MASK_XBUTTON2;
 	}
 
 	return godot_button_mask;

+ 3 - 3
platform/android/android_input_handler.h

@@ -53,10 +53,10 @@ public:
 	struct JoypadEvent {
 		int device = 0;
 		int type = 0;
-		int index = 0;
+		int index = 0; // Can be either JoyAxis or JoyButton.
 		bool pressed = false;
 		float value = 0;
-		int hat = 0;
+		HatMask hat = HatMask::CENTER;
 	};
 
 private:
@@ -65,7 +65,7 @@ private:
 	bool control_mem = false;
 	bool meta_mem = false;
 
-	MouseButton buttons_state = MOUSE_BUTTON_NONE;
+	MouseButton buttons_state = MouseButton::NONE;
 
 	Vector<TouchPos> touch;
 	Point2 hover_prev_pos; // needed to calculate the relative position on hover events

+ 3 - 3
platform/android/android_keys_utils.cpp

@@ -30,12 +30,12 @@
 
 #include "android_keys_utils.h"
 
-unsigned int android_get_keysym(unsigned int p_code) {
-	for (int i = 0; _ak_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
+Key android_get_keysym(unsigned int p_code) {
+	for (int i = 0; _ak_to_keycode[i].keysym != Key::UNKNOWN; i++) {
 		if (_ak_to_keycode[i].keycode == p_code) {
 			return _ak_to_keycode[i].keysym;
 		}
 	}
 
-	return KEY_UNKNOWN;
+	return Key::UNKNOWN;
 }

+ 92 - 92
platform/android/android_keys_utils.h

@@ -35,101 +35,101 @@
 #include <core/os/keyboard.h>
 
 struct _WinTranslatePair {
-	unsigned int keysym = 0;
+	Key keysym = Key::NONE;
 	unsigned int keycode = 0;
 };
 
 static _WinTranslatePair _ak_to_keycode[] = {
-	{ KEY_TAB, AKEYCODE_TAB },
-	{ KEY_ENTER, AKEYCODE_ENTER },
-	{ KEY_SHIFT, AKEYCODE_SHIFT_LEFT },
-	{ KEY_SHIFT, AKEYCODE_SHIFT_RIGHT },
-	{ KEY_ALT, AKEYCODE_ALT_LEFT },
-	{ KEY_ALT, AKEYCODE_ALT_RIGHT },
-	{ KEY_MENU, AKEYCODE_MENU },
-	{ KEY_PAUSE, AKEYCODE_MEDIA_PLAY_PAUSE },
-	{ KEY_ESCAPE, AKEYCODE_BACK },
-	{ KEY_SPACE, AKEYCODE_SPACE },
-	{ KEY_PAGEUP, AKEYCODE_PAGE_UP },
-	{ KEY_PAGEDOWN, AKEYCODE_PAGE_DOWN },
-	{ KEY_HOME, AKEYCODE_HOME }, //(0x24)
-	{ KEY_LEFT, AKEYCODE_DPAD_LEFT },
-	{ KEY_UP, AKEYCODE_DPAD_UP },
-	{ KEY_RIGHT, AKEYCODE_DPAD_RIGHT },
-	{ KEY_DOWN, AKEYCODE_DPAD_DOWN },
-	{ KEY_PERIODCENTERED, AKEYCODE_DPAD_CENTER },
-	{ KEY_BACKSPACE, AKEYCODE_DEL },
-	{ KEY_0, AKEYCODE_0 }, ////0 key
-	{ KEY_1, AKEYCODE_1 }, ////1 key
-	{ KEY_2, AKEYCODE_2 }, ////2 key
-	{ KEY_3, AKEYCODE_3 }, ////3 key
-	{ KEY_4, AKEYCODE_4 }, ////4 key
-	{ KEY_5, AKEYCODE_5 }, ////5 key
-	{ KEY_6, AKEYCODE_6 }, ////6 key
-	{ KEY_7, AKEYCODE_7 }, ////7 key
-	{ KEY_8, AKEYCODE_8 }, ////8 key
-	{ KEY_9, AKEYCODE_9 }, ////9 key
-	{ KEY_A, AKEYCODE_A }, ////A key
-	{ KEY_B, AKEYCODE_B }, ////B key
-	{ KEY_C, AKEYCODE_C }, ////C key
-	{ KEY_D, AKEYCODE_D }, ////D key
-	{ KEY_E, AKEYCODE_E }, ////E key
-	{ KEY_F, AKEYCODE_F }, ////F key
-	{ KEY_G, AKEYCODE_G }, ////G key
-	{ KEY_H, AKEYCODE_H }, ////H key
-	{ KEY_I, AKEYCODE_I }, ////I key
-	{ KEY_J, AKEYCODE_J }, ////J key
-	{ KEY_K, AKEYCODE_K }, ////K key
-	{ KEY_L, AKEYCODE_L }, ////L key
-	{ KEY_M, AKEYCODE_M }, ////M key
-	{ KEY_N, AKEYCODE_N }, ////N key
-	{ KEY_O, AKEYCODE_O }, ////O key
-	{ KEY_P, AKEYCODE_P }, ////P key
-	{ KEY_Q, AKEYCODE_Q }, ////Q key
-	{ KEY_R, AKEYCODE_R }, ////R key
-	{ KEY_S, AKEYCODE_S }, ////S key
-	{ KEY_T, AKEYCODE_T }, ////T key
-	{ KEY_U, AKEYCODE_U }, ////U key
-	{ KEY_V, AKEYCODE_V }, ////V key
-	{ KEY_W, AKEYCODE_W }, ////W key
-	{ KEY_X, AKEYCODE_X }, ////X key
-	{ KEY_Y, AKEYCODE_Y }, ////Y key
-	{ KEY_Z, AKEYCODE_Z }, ////Z key
-	{ KEY_HOMEPAGE, AKEYCODE_EXPLORER },
-	{ KEY_LAUNCH0, AKEYCODE_BUTTON_A },
-	{ KEY_LAUNCH1, AKEYCODE_BUTTON_B },
-	{ KEY_LAUNCH2, AKEYCODE_BUTTON_C },
-	{ KEY_LAUNCH3, AKEYCODE_BUTTON_X },
-	{ KEY_LAUNCH4, AKEYCODE_BUTTON_Y },
-	{ KEY_LAUNCH5, AKEYCODE_BUTTON_Z },
-	{ KEY_LAUNCH6, AKEYCODE_BUTTON_L1 },
-	{ KEY_LAUNCH7, AKEYCODE_BUTTON_R1 },
-	{ KEY_LAUNCH8, AKEYCODE_BUTTON_L2 },
-	{ KEY_LAUNCH9, AKEYCODE_BUTTON_R2 },
-	{ KEY_LAUNCHA, AKEYCODE_BUTTON_THUMBL },
-	{ KEY_LAUNCHB, AKEYCODE_BUTTON_THUMBR },
-	{ KEY_LAUNCHC, AKEYCODE_BUTTON_START },
-	{ KEY_LAUNCHD, AKEYCODE_BUTTON_SELECT },
-	{ KEY_LAUNCHE, AKEYCODE_BUTTON_MODE },
-	{ KEY_VOLUMEMUTE, AKEYCODE_MUTE },
-	{ KEY_VOLUMEDOWN, AKEYCODE_VOLUME_DOWN },
-	{ KEY_VOLUMEUP, AKEYCODE_VOLUME_UP },
-	{ KEY_BACK, AKEYCODE_MEDIA_REWIND },
-	{ KEY_FORWARD, AKEYCODE_MEDIA_FAST_FORWARD },
-	{ KEY_MEDIANEXT, AKEYCODE_MEDIA_NEXT },
-	{ KEY_MEDIAPREVIOUS, AKEYCODE_MEDIA_PREVIOUS },
-	{ KEY_MEDIASTOP, AKEYCODE_MEDIA_STOP },
-	{ KEY_PLUS, AKEYCODE_PLUS },
-	{ KEY_EQUAL, AKEYCODE_EQUALS }, // the '+' key
-	{ KEY_COMMA, AKEYCODE_COMMA }, // the ',' key
-	{ KEY_MINUS, AKEYCODE_MINUS }, // the '-' key
-	{ KEY_SLASH, AKEYCODE_SLASH }, // the '/?' key
-	{ KEY_BACKSLASH, AKEYCODE_BACKSLASH },
-	{ KEY_BRACKETLEFT, AKEYCODE_LEFT_BRACKET },
-	{ KEY_BRACKETRIGHT, AKEYCODE_RIGHT_BRACKET },
-	{ KEY_CTRL, AKEYCODE_CTRL_LEFT },
-	{ KEY_CTRL, AKEYCODE_CTRL_RIGHT },
-	{ KEY_UNKNOWN, 0 }
+	{ Key::TAB, AKEYCODE_TAB },
+	{ Key::ENTER, AKEYCODE_ENTER },
+	{ Key::SHIFT, AKEYCODE_SHIFT_LEFT },
+	{ Key::SHIFT, AKEYCODE_SHIFT_RIGHT },
+	{ Key::ALT, AKEYCODE_ALT_LEFT },
+	{ Key::ALT, AKEYCODE_ALT_RIGHT },
+	{ Key::MENU, AKEYCODE_MENU },
+	{ Key::PAUSE, AKEYCODE_MEDIA_PLAY_PAUSE },
+	{ Key::ESCAPE, AKEYCODE_BACK },
+	{ Key::SPACE, AKEYCODE_SPACE },
+	{ Key::PAGEUP, AKEYCODE_PAGE_UP },
+	{ Key::PAGEDOWN, AKEYCODE_PAGE_DOWN },
+	{ Key::HOME, AKEYCODE_HOME }, //(0x24)
+	{ Key::LEFT, AKEYCODE_DPAD_LEFT },
+	{ Key::UP, AKEYCODE_DPAD_UP },
+	{ Key::RIGHT, AKEYCODE_DPAD_RIGHT },
+	{ Key::DOWN, AKEYCODE_DPAD_DOWN },
+	{ Key::PERIODCENTERED, AKEYCODE_DPAD_CENTER },
+	{ Key::BACKSPACE, AKEYCODE_DEL },
+	{ Key::KEY_0, AKEYCODE_0 },
+	{ Key::KEY_1, AKEYCODE_1 },
+	{ Key::KEY_2, AKEYCODE_2 },
+	{ Key::KEY_3, AKEYCODE_3 },
+	{ Key::KEY_4, AKEYCODE_4 },
+	{ Key::KEY_5, AKEYCODE_5 },
+	{ Key::KEY_6, AKEYCODE_6 },
+	{ Key::KEY_7, AKEYCODE_7 },
+	{ Key::KEY_8, AKEYCODE_8 },
+	{ Key::KEY_9, AKEYCODE_9 },
+	{ Key::A, AKEYCODE_A },
+	{ Key::B, AKEYCODE_B },
+	{ Key::C, AKEYCODE_C },
+	{ Key::D, AKEYCODE_D },
+	{ Key::E, AKEYCODE_E },
+	{ Key::F, AKEYCODE_F },
+	{ Key::G, AKEYCODE_G },
+	{ Key::H, AKEYCODE_H },
+	{ Key::I, AKEYCODE_I },
+	{ Key::J, AKEYCODE_J },
+	{ Key::K, AKEYCODE_K },
+	{ Key::L, AKEYCODE_L },
+	{ Key::M, AKEYCODE_M },
+	{ Key::N, AKEYCODE_N },
+	{ Key::O, AKEYCODE_O },
+	{ Key::P, AKEYCODE_P },
+	{ Key::Q, AKEYCODE_Q },
+	{ Key::R, AKEYCODE_R },
+	{ Key::S, AKEYCODE_S },
+	{ Key::T, AKEYCODE_T },
+	{ Key::U, AKEYCODE_U },
+	{ Key::V, AKEYCODE_V },
+	{ Key::W, AKEYCODE_W },
+	{ Key::X, AKEYCODE_X },
+	{ Key::Y, AKEYCODE_Y },
+	{ Key::Z, AKEYCODE_Z },
+	{ Key::HOMEPAGE, AKEYCODE_EXPLORER },
+	{ Key::LAUNCH0, AKEYCODE_BUTTON_A },
+	{ Key::LAUNCH1, AKEYCODE_BUTTON_B },
+	{ Key::LAUNCH2, AKEYCODE_BUTTON_C },
+	{ Key::LAUNCH3, AKEYCODE_BUTTON_X },
+	{ Key::LAUNCH4, AKEYCODE_BUTTON_Y },
+	{ Key::LAUNCH5, AKEYCODE_BUTTON_Z },
+	{ Key::LAUNCH6, AKEYCODE_BUTTON_L1 },
+	{ Key::LAUNCH7, AKEYCODE_BUTTON_R1 },
+	{ Key::LAUNCH8, AKEYCODE_BUTTON_L2 },
+	{ Key::LAUNCH9, AKEYCODE_BUTTON_R2 },
+	{ Key::LAUNCHA, AKEYCODE_BUTTON_THUMBL },
+	{ Key::LAUNCHB, AKEYCODE_BUTTON_THUMBR },
+	{ Key::LAUNCHC, AKEYCODE_BUTTON_START },
+	{ Key::LAUNCHD, AKEYCODE_BUTTON_SELECT },
+	{ Key::LAUNCHE, AKEYCODE_BUTTON_MODE },
+	{ Key::VOLUMEMUTE, AKEYCODE_MUTE },
+	{ Key::VOLUMEDOWN, AKEYCODE_VOLUME_DOWN },
+	{ Key::VOLUMEUP, AKEYCODE_VOLUME_UP },
+	{ Key::BACK, AKEYCODE_MEDIA_REWIND },
+	{ Key::FORWARD, AKEYCODE_MEDIA_FAST_FORWARD },
+	{ Key::MEDIANEXT, AKEYCODE_MEDIA_NEXT },
+	{ Key::MEDIAPREVIOUS, AKEYCODE_MEDIA_PREVIOUS },
+	{ Key::MEDIASTOP, AKEYCODE_MEDIA_STOP },
+	{ Key::PLUS, AKEYCODE_PLUS },
+	{ Key::EQUAL, AKEYCODE_EQUALS }, // the '+' key
+	{ Key::COMMA, AKEYCODE_COMMA }, // the ',' key
+	{ Key::MINUS, AKEYCODE_MINUS }, // the '-' key
+	{ Key::SLASH, AKEYCODE_SLASH }, // the '/?' key
+	{ Key::BACKSLASH, AKEYCODE_BACKSLASH },
+	{ Key::BRACKETLEFT, AKEYCODE_LEFT_BRACKET },
+	{ Key::BRACKETRIGHT, AKEYCODE_RIGHT_BRACKET },
+	{ Key::CTRL, AKEYCODE_CTRL_LEFT },
+	{ Key::CTRL, AKEYCODE_CTRL_RIGHT },
+	{ Key::UNKNOWN, 0 }
 };
 /*
 TODO: map these android key:
@@ -157,6 +157,6 @@ TODO: map these android key:
 	AKEYCODE_SWITCH_CHARSET  = 95,
 */
 
-unsigned int android_get_keysym(unsigned int p_code);
+Key android_get_keysym(unsigned int p_code);
 
 #endif // ANDROID_KEYS_UTILS_H

+ 15 - 11
platform/android/java_godot_lib_jni.cpp

@@ -317,8 +317,9 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv *env
 
 // Called on the UI thread
 JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env, jclass clazz, jint p_device, jint p_axis, jfloat p_value) {
-	if (step.get() <= 0)
+	if (step.get() <= 0) {
 		return;
+	}
 
 	AndroidInputHandler::JoypadEvent jevent;
 	jevent.device = p_device;
@@ -331,24 +332,27 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv *env,
 
 // Called on the UI thread
 JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, jclass clazz, jint p_device, jint p_hat_x, jint p_hat_y) {
-	if (step.get() <= 0)
+	if (step.get() <= 0) {
 		return;
+	}
 
 	AndroidInputHandler::JoypadEvent jevent;
 	jevent.device = p_device;
 	jevent.type = AndroidInputHandler::JOY_EVENT_HAT;
-	int hat = 0;
+	HatMask hat = HatMask::CENTER;
 	if (p_hat_x != 0) {
-		if (p_hat_x < 0)
-			hat |= HatMask::HAT_MASK_LEFT;
-		else
-			hat |= HatMask::HAT_MASK_RIGHT;
+		if (p_hat_x < 0) {
+			hat |= HatMask::LEFT;
+		} else {
+			hat |= HatMask::RIGHT;
+		}
 	}
 	if (p_hat_y != 0) {
-		if (p_hat_y < 0)
-			hat |= HatMask::HAT_MASK_UP;
-		else
-			hat |= HatMask::HAT_MASK_DOWN;
+		if (p_hat_y < 0) {
+			hat |= HatMask::UP;
+		} else {
+			hat |= HatMask::DOWN;
+		}
 	}
 	jevent.hat = hat;
 

+ 1 - 1
platform/iphone/display_server_iphone.mm

@@ -261,7 +261,7 @@ void DisplayServerIPhone::key(Key p_key, bool p_pressed) {
 	ev->set_pressed(p_pressed);
 	ev->set_keycode(p_key);
 	ev->set_physical_keycode(p_key);
-	ev->set_unicode(p_key);
+	ev->set_unicode((char32_t)p_key);
 	perform_event(ev);
 };
 

+ 22 - 22
platform/iphone/joypad_iphone.mm

@@ -259,31 +259,31 @@ void JoypadIPhone::start_processing() {
 			int joy_id = [self getJoyIdForController:controller];
 
 			if (element == gamepad.buttonA) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_A,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::A,
 						gamepad.buttonA.isPressed);
 			} else if (element == gamepad.buttonB) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_B,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::B,
 						gamepad.buttonB.isPressed);
 			} else if (element == gamepad.buttonX) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_X,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::X,
 						gamepad.buttonX.isPressed);
 			} else if (element == gamepad.buttonY) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_Y,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::Y,
 						gamepad.buttonY.isPressed);
 			} else if (element == gamepad.leftShoulder) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_LEFT_SHOULDER,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::LEFT_SHOULDER,
 						gamepad.leftShoulder.isPressed);
 			} else if (element == gamepad.rightShoulder) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_RIGHT_SHOULDER,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::RIGHT_SHOULDER,
 						gamepad.rightShoulder.isPressed);
 			} else if (element == gamepad.dpad) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_UP,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_UP,
 						gamepad.dpad.up.isPressed);
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_DOWN,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_DOWN,
 						gamepad.dpad.down.isPressed);
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_LEFT,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_LEFT,
 						gamepad.dpad.left.isPressed);
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_RIGHT,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_RIGHT,
 						gamepad.dpad.right.isPressed);
 			};
 
@@ -291,20 +291,20 @@ void JoypadIPhone::start_processing() {
 			jx.min = -1;
 			if (element == gamepad.leftThumbstick) {
 				jx.value = gamepad.leftThumbstick.xAxis.value;
-				Input::get_singleton()->joy_axis(joy_id, JOY_AXIS_LEFT_X, jx);
+				Input::get_singleton()->joy_axis(joy_id, JoyAxis::LEFT_X, jx);
 				jx.value = -gamepad.leftThumbstick.yAxis.value;
-				Input::get_singleton()->joy_axis(joy_id, JOY_AXIS_LEFT_Y, jx);
+				Input::get_singleton()->joy_axis(joy_id, JoyAxis::LEFT_Y, jx);
 			} else if (element == gamepad.rightThumbstick) {
 				jx.value = gamepad.rightThumbstick.xAxis.value;
-				Input::get_singleton()->joy_axis(joy_id, JOY_AXIS_RIGHT_X, jx);
+				Input::get_singleton()->joy_axis(joy_id, JoyAxis::RIGHT_X, jx);
 				jx.value = -gamepad.rightThumbstick.yAxis.value;
-				Input::get_singleton()->joy_axis(joy_id, JOY_AXIS_RIGHT_Y, jx);
+				Input::get_singleton()->joy_axis(joy_id, JoyAxis::RIGHT_Y, jx);
 			} else if (element == gamepad.leftTrigger) {
 				jx.value = gamepad.leftTrigger.value;
-				Input::get_singleton()->joy_axis(joy_id, JOY_AXIS_TRIGGER_LEFT, jx);
+				Input::get_singleton()->joy_axis(joy_id, JoyAxis::TRIGGER_LEFT, jx);
 			} else if (element == gamepad.rightTrigger) {
 				jx.value = gamepad.rightTrigger.value;
-				Input::get_singleton()->joy_axis(joy_id, JOY_AXIS_TRIGGER_RIGHT, jx);
+				Input::get_singleton()->joy_axis(joy_id, JoyAxis::TRIGGER_RIGHT, jx);
 			};
 		};
 	} else if (controller.microGamepad != nil) {
@@ -319,18 +319,18 @@ void JoypadIPhone::start_processing() {
 			int joy_id = [self getJoyIdForController:controller];
 
 			if (element == gamepad.buttonA) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_A,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::A,
 						gamepad.buttonA.isPressed);
 			} else if (element == gamepad.buttonX) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_X,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::X,
 						gamepad.buttonX.isPressed);
 			} else if (element == gamepad.dpad) {
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_UP,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_UP,
 						gamepad.dpad.up.isPressed);
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_DOWN,
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_DOWN,
 						gamepad.dpad.down.isPressed);
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_LEFT, gamepad.dpad.left.isPressed);
-				Input::get_singleton()->joy_button(joy_id, JOY_BUTTON_DPAD_RIGHT, gamepad.dpad.right.isPressed);
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_LEFT, gamepad.dpad.left.isPressed);
+				Input::get_singleton()->joy_button(joy_id, JoyButton::DPAD_RIGHT, gamepad.dpad.right.isPressed);
 			};
 		};
 	}

+ 4 - 4
platform/iphone/keyboard_input_view.mm

@@ -115,8 +115,8 @@
 
 - (void)deleteText:(NSInteger)charactersToDelete {
 	for (int i = 0; i < charactersToDelete; i++) {
-		DisplayServerIPhone::get_singleton()->key(KEY_BACKSPACE, true);
-		DisplayServerIPhone::get_singleton()->key(KEY_BACKSPACE, false);
+		DisplayServerIPhone::get_singleton()->key(Key::BACKSPACE, true);
+		DisplayServerIPhone::get_singleton()->key(Key::BACKSPACE, false);
 	}
 }
 
@@ -129,10 +129,10 @@
 
 		switch (character) {
 			case 10:
-				character = KEY_ENTER;
+				character = (int)Key::ENTER;
 				break;
 			case 8198:
-				character = KEY_SPACE;
+				character = (int)Key::SPACE;
 				break;
 			default:
 				break;

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio