Skip to content

Commit

Permalink
Allow middle-click to close scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ttencate committed Aug 14, 2018
1 parent b293dd3 commit d867f11
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2384,9 +2384,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;
}
}
}

Expand Down

0 comments on commit d867f11

Please sign in to comment.