Use defined key mapping for closing popups and dialogs

As opposed to hardcoding the escape key. Also removed such hardcoding in a few other places as well as a hardcoded enter key in one of the affected input fields.
This commit is contained in:
Arman Elgudzhyan 2023-05-20 17:26:13 -07:00
parent 809a982162
commit 8ab2cf3d2d
7 changed files with 26 additions and 66 deletions

View file

@ -1834,19 +1834,13 @@ void ThemeItemEditorDialog::_edit_theme_item_gui_input(const Ref<InputEvent> &p_
return;
}
switch (k->get_keycode()) {
case Key::KP_ENTER:
case Key::ENTER: {
_confirm_edit_theme_item();
edit_theme_item_dialog->hide();
edit_theme_item_dialog->set_input_as_handled();
} break;
case Key::ESCAPE: {
edit_theme_item_dialog->hide();
edit_theme_item_dialog->set_input_as_handled();
} break;
default:
break;
if (k->is_action_pressed(SNAME("ui_accept"), false, true)) {
_confirm_edit_theme_item();
edit_theme_item_dialog->hide();
edit_theme_item_dialog->set_input_as_handled();
} else if (k->is_action_pressed(SNAME("ui_cancel"), false, true)) {
edit_theme_item_dialog->hide();
edit_theme_item_dialog->set_input_as_handled();
}
}
}