diff --git a/editor_modules/editor_code_editor/editor_code_text_editor.cpp b/editor_modules/editor_code_editor/editor_code_text_editor.cpp index 80d90b583..5c6c568da 100644 --- a/editor_modules/editor_code_editor/editor_code_text_editor.cpp +++ b/editor_modules/editor_code_editor/editor_code_text_editor.cpp @@ -69,36 +69,6 @@ #include "editor_script_editor.h" -// This function should be used to handle shortcuts that could otherwise -// be handled too late if they weren't handled here. -void EditorCodeTextEditor::_shortcut_input(const Ref &event) { - const Ref key_event = event; - if (!key_event.is_valid() || !key_event->is_pressed()) { - return; - } - - if (ED_IS_SHORTCUT("script_text_editor/move_up", key_event)) { - move_lines_up(); - accept_event(); - return; - } - if (ED_IS_SHORTCUT("script_text_editor/move_down", key_event)) { - move_lines_down(); - accept_event(); - return; - } - if (ED_IS_SHORTCUT("script_text_editor/delete_line", key_event)) { - delete_lines(); - accept_event(); - return; - } - if (ED_IS_SHORTCUT("script_text_editor/duplicate_selection", key_event)) { - duplicate_selection(); - accept_event(); - return; - } -} - void EditorCodeTextEditor::_text_editor_gui_input(const Ref &p_event) { Ref mb = p_event; @@ -1045,7 +1015,6 @@ void EditorCodeTextEditor::remove_all_bookmarks() { } void EditorCodeTextEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_shortcut_input"), &EditorCodeTextEditor::_shortcut_input); ClassDB::bind_method("_text_editor_gui_input", &EditorCodeTextEditor::_text_editor_gui_input); ClassDB::bind_method("_line_col_changed", &EditorCodeTextEditor::_line_col_changed); ClassDB::bind_method("_text_changed", &EditorCodeTextEditor::_text_changed); diff --git a/editor_modules/editor_code_editor/editor_code_text_editor.h b/editor_modules/editor_code_editor/editor_code_text_editor.h index 3e5fca400..77d81a5f2 100644 --- a/editor_modules/editor_code_editor/editor_code_text_editor.h +++ b/editor_modules/editor_code_editor/editor_code_text_editor.h @@ -90,7 +90,6 @@ class EditorCodeTextEditor : public VBoxContainer { void _font_resize_timeout(); bool _add_font_size(int p_delta); - void _shortcut_input(const Ref &event); void _text_editor_gui_input(const Ref &p_event); void _zoom_in(); void _zoom_out(); diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index addd27043..df107a531 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -30,9 +30,9 @@ #include "menu_button.h" #include "core/input/input.h" +#include "core/input/shortcut.h" #include "core/os/keyboard.h" #include "scene/gui/popup_menu.h" -#include "core/input/shortcut.h" #include "scene/main/viewport.h" void MenuButton::_shortcut_input(Ref p_event) { @@ -42,8 +42,6 @@ void MenuButton::_shortcut_input(Ref p_event) { return; } - BaseButton::_shortcut_input(p_event); - if (p_event->is_pressed() && !p_event->is_echo() && (Object::cast_to(p_event.ptr()) || Object::cast_to(p_event.ptr()) || Object::cast_to(*p_event))) { if (!get_parent() || !is_visible_in_tree() || is_disabled()) { return; @@ -53,8 +51,11 @@ void MenuButton::_shortcut_input(Ref p_event) { if (popup->activate_item_by_event(p_event, global_only)) { accept_event(); + return; } } + + BaseButton::_shortcut_input(p_event); } void MenuButton::pressed() {