From d867f11820cf67e48e12570b8b456c81cf7697de Mon Sep 17 00:00:00 2001 From: Thomas ten Cate Date: Fri, 10 Aug 2018 10:37:04 +0200 Subject: Allow middle-click to close scripts Fixes #20871 --- editor/plugins/script_editor_plugin.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'editor') diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index af242e2d98..f52c0cd1fa 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2384,9 +2384,23 @@ void ScriptEditor::_unhandled_input(const Ref &p_event) { void ScriptEditor::_script_list_gui_input(const Ref &ev) { Ref mb = ev; - if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) { + if (mb.is_valid() && mb->is_pressed()) { + switch (mb->get_button_index()) { + + case BUTTON_MIDDLE: { + // Right-click selects automatically; middle-click does not. + int idx = script_list->get_item_at_position(mb->get_position(), true); + if (idx >= 0) { + script_list->select(idx); + _script_selected(idx); + _menu_option(FILE_CLOSE); + } + } break; - _make_script_list_context_menu(); + case BUTTON_RIGHT: { + _make_script_list_context_menu(); + } break; + } } } -- cgit v1.2.3