summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-08-15 01:10:21 +0200
committerGitHub <noreply@github.com>2018-08-15 01:10:21 +0200
commit859f3bf5a929c885d217011440d8d5a4606f6e99 (patch)
tree868e061a24bd723086f6b6d6f5b6e2399c3dc3f8
parent4548ec4a492402402cb737e6abc17cb3c25672c4 (diff)
parentd867f11820cf67e48e12570b8b456c81cf7697de (diff)
Merge pull request #20873 from ttencate/master
Allow middle-click to close scripts
-rw-r--r--editor/plugins/script_editor_plugin.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 7d72537e32..b90cfb479d 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2387,9 +2387,23 @@ void ScriptEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) {
Ref<InputEventMouseButton> 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;
+ }
}
}