Fix key mapping changes when moving from macOS to other platform

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

View file

@ -800,7 +800,7 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
if (mb->is_pressed() && mb->is_command_pressed()) {
if (mb->is_pressed() && mb->is_command_or_control_pressed()) {
if (mb->get_button_index() == MouseButton::WHEEL_UP) {
_zoom_in();
} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN) {
@ -1867,10 +1867,10 @@ void CodeTextEditor::update_toggle_scripts_button() {
CodeTextEditor::CodeTextEditor() {
code_complete_func = nullptr;
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/zoom_in", TTR("Zoom In"), KeyModifierMask::CMD_OR_CTRL | Key::EQUAL);
ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KeyModifierMask::CMD_OR_CTRL | Key::MINUS);
ED_SHORTCUT_ARRAY("script_editor/reset_zoom", TTR("Reset Zoom"),
{ int32_t(KeyModifierMask::CMD | Key::KEY_0), int32_t(KeyModifierMask::CMD | Key::KP_0) });
{ int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KEY_0), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_0) });
text_editor = memnew(CodeEdit);
add_child(text_editor);