summaryrefslogtreecommitdiffstats
path: root/editor/editor_layouts_dialog.cpp
diff options
context:
space:
mode:
authorArman Elgudzhyan <48544263+puchik@users.noreply.github.com>2023-05-20 17:26:13 -0700
committerArman Elgudzhyan <48544263+puchik@users.noreply.github.com>2023-05-20 17:39:59 -0700
commit8ab2cf3d2d7efee7316955a5bb7bffb3ad81f7a5 (patch)
tree4c7cf862a380751232223b9a8ae721ff095352b3 /editor/editor_layouts_dialog.cpp
parent809a98216267f3066b9fec2f02b2042bdc9d3e0d (diff)
downloadredot-engine-8ab2cf3d2d7efee7316955a5bb7bffb3ad81f7a5.tar.gz
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.
Diffstat (limited to 'editor/editor_layouts_dialog.cpp')
-rw-r--r--editor/editor_layouts_dialog.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 31228ab57d..1f7172db57 100644
--- a/editor/editor_layouts_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -42,25 +42,15 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
if (k.is_valid()) {
- if (!k->is_pressed()) {
- return;
- }
-
- switch (k->get_keycode()) {
- case Key::KP_ENTER:
- case Key::ENTER: {
- if (get_hide_on_ok()) {
- hide();
- }
- ok_pressed();
- set_input_as_handled();
- } break;
- case Key::ESCAPE: {
+ if (k->is_action_pressed(SNAME("ui_accept"), false, true)) {
+ if (get_hide_on_ok()) {
hide();
- set_input_as_handled();
- } break;
- default:
- break;
+ }
+ ok_pressed();
+ set_input_as_handled();
+ } else if (k->is_action_pressed(SNAME("ui_cancel"), false, true)) {
+ hide();
+ set_input_as_handled();
}
}
}