From 7b7c7c8dc0e3572a7d66d274b3e4db43695ce814 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Sun, 6 Aug 2017 16:26:07 +0300 Subject: [PATCH] Rename KEY_RETURN to KEY_ENTER and KEY_ENTER to KEY_KP_ENTER Closes #7695 --- core/global_constants.cpp | 2 +- core/input_map.cpp | 4 ++-- core/os/keyboard.cpp | 4 ++-- core/os/keyboard.h | 4 ++-- core/project_settings.cpp | 4 ++-- doc/base/classes.xml | 4 ++-- editor/editor_name_dialog.cpp | 4 ++-- editor/project_manager.cpp | 2 +- platform/haiku/key_mapping_haiku.cpp | 2 +- platform/javascript/dom_keys.h | 2 +- platform/osx/os_osx.mm | 4 ++-- platform/windows/key_mapping_win.cpp | 2 +- platform/windows/os_windows.cpp | 2 +- platform/x11/key_mapping_x11.cpp | 4 ++-- scene/gui/line_edit.cpp | 4 ++-- scene/gui/popup_menu.cpp | 4 ++-- scene/gui/text_edit.cpp | 6 +++--- scene/gui/tree.cpp | 8 ++++---- 18 files changed, 33 insertions(+), 33 deletions(-) diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 18071d77488..9e745ecb983 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -67,8 +67,8 @@ static _GlobalConstant _global_constants[] = { BIND_GLOBAL_CONSTANT(KEY_TAB), BIND_GLOBAL_CONSTANT(KEY_BACKTAB), BIND_GLOBAL_CONSTANT(KEY_BACKSPACE), - BIND_GLOBAL_CONSTANT(KEY_RETURN), BIND_GLOBAL_CONSTANT(KEY_ENTER), + BIND_GLOBAL_CONSTANT(KEY_KP_ENTER), BIND_GLOBAL_CONSTANT(KEY_INSERT), BIND_GLOBAL_CONSTANT(KEY_DELETE), BIND_GLOBAL_CONSTANT(KEY_PAUSE), diff --git a/core/input_map.cpp b/core/input_map.cpp index 24d0624e98f..85e627f3520 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -219,11 +219,11 @@ void InputMap::load_default() { add_action("ui_accept"); key.instance(); - key->set_scancode(KEY_RETURN); + key->set_scancode(KEY_ENTER); action_add_event("ui_accept", key); key.instance(); - key->set_scancode(KEY_ENTER); + key->set_scancode(KEY_KP_ENTER); action_add_event("ui_accept", key); key.instance(); diff --git a/core/os/keyboard.cpp b/core/os/keyboard.cpp index e154b1934d7..9b3e376ea6b 100644 --- a/core/os/keyboard.cpp +++ b/core/os/keyboard.cpp @@ -42,8 +42,8 @@ static const _KeyCodeText _keycodes[] = { {KEY_TAB ,"Tab"}, {KEY_BACKTAB ,"BackTab"}, {KEY_BACKSPACE ,"BackSpace"}, - {KEY_RETURN ,"Return"}, {KEY_ENTER ,"Enter"}, + {KEY_KP_ENTER ,"Kp Enter"}, {KEY_INSERT ,"Insert"}, {KEY_DELETE ,"Delete"}, {KEY_PAUSE ,"Pause"}, @@ -294,8 +294,8 @@ bool keycode_has_unicode(uint32_t p_keycode) { case KEY_TAB: case KEY_BACKTAB: case KEY_BACKSPACE: - case KEY_RETURN: case KEY_ENTER: + case KEY_KP_ENTER: case KEY_INSERT: case KEY_DELETE: case KEY_PAUSE: diff --git a/core/os/keyboard.h b/core/os/keyboard.h index c6985c887db..1ed93e35403 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -57,8 +57,8 @@ enum KeyList { KEY_TAB = SPKEY | 0x02, KEY_BACKTAB = SPKEY | 0x03, KEY_BACKSPACE = SPKEY | 0x04, - KEY_RETURN = SPKEY | 0x05, - KEY_ENTER = SPKEY | 0x06, + KEY_ENTER = SPKEY | 0x05, + KEY_KP_ENTER = SPKEY | 0x06, KEY_INSERT = SPKEY | 0x07, KEY_DELETE = SPKEY | 0x08, KEY_PAUSE = SPKEY | 0x09, diff --git a/core/project_settings.cpp b/core/project_settings.cpp index b31f78ec20d..f6e0d2e991e 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -925,10 +925,10 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("application/config/use_shared_user_dir", true); key.instance(); - key->set_scancode(KEY_RETURN); + key->set_scancode(KEY_ENTER); va.push_back(key); key.instance(); - key->set_scancode(KEY_ENTER); + key->set_scancode(KEY_KP_ENTER); va.push_back(key); key.instance(); key->set_scancode(KEY_SPACE); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 268bfeca1a3..cd5b950f57e 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -846,10 +846,10 @@ Backspace Key - + Return Key (On Main Keyboard) - + Enter Key (On Numpad) diff --git a/editor/editor_name_dialog.cpp b/editor/editor_name_dialog.cpp index 7435e9a9f7c..6ebfcbf3132 100644 --- a/editor/editor_name_dialog.cpp +++ b/editor/editor_name_dialog.cpp @@ -42,8 +42,8 @@ void EditorNameDialog::_line_gui_input(const Ref &p_event) { return; switch (k->get_scancode()) { - case KEY_ENTER: - case KEY_RETURN: { + case KEY_KP_ENTER: + case KEY_ENTER: { if (get_hide_on_ok()) hide(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 82f17b80d56..d5a56f644fd 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -573,7 +573,7 @@ void ProjectManager::_unhandled_input(const Ref &p_ev) { switch (k->get_scancode()) { - case KEY_RETURN: { + case KEY_ENTER: { _open_project(); } break; diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp index 9df7b2f047c..3db31fa3e4a 100644 --- a/platform/haiku/key_mapping_haiku.cpp +++ b/platform/haiku/key_mapping_haiku.cpp @@ -83,7 +83,7 @@ static _HaikuTranslatePair _fn_to_keycode[] = { static _HaikuTranslatePair _hb_to_keycode[] = { { KEY_BACKSPACE, B_BACKSPACE }, { KEY_TAB, B_TAB }, - { KEY_RETURN, B_RETURN }, + { KEY_ENTER, B_RETURN }, { KEY_CAPSLOCK, B_CAPS_LOCK }, { KEY_ESCAPE, B_ESCAPE }, { KEY_SPACE, B_SPACE }, diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h index 979731d1573..4b8b764c454 100644 --- a/platform/javascript/dom_keys.h +++ b/platform/javascript/dom_keys.h @@ -249,7 +249,7 @@ int dom2godot_scancode(int dom_keycode) { case DOM_VK_RETURN: case DOM_VK_ENTER: // unused according to MDN - return KEY_RETURN; + return KEY_ENTER; case DOM_VK_SHIFT: return KEY_SHIFT; case DOM_VK_CONTROL: return KEY_CONTROL; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 4a01532d891..cfa039c1306 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -518,7 +518,7 @@ static int translateKey(unsigned int key) { /* 21 */ KEY_BRACELEFT, /* 22 */ KEY_I, /* 23 */ KEY_P, - /* 24 */ KEY_RETURN, + /* 24 */ KEY_ENTER, /* 25 */ KEY_L, /* 26 */ KEY_J, /* 27 */ KEY_APOSTROPHE, @@ -558,7 +558,7 @@ static int translateKey(unsigned int key) { /* 49 */ KEY_UNKNOWN, /* VolumeDown */ /* 4a */ KEY_UNKNOWN, /* Mute */ /* 4b */ KEY_KP_DIVIDE, - /* 4c */ KEY_ENTER, + /* 4c */ KEY_KP_ENTER, /* 4d */ KEY_UNKNOWN, /* 4e */ KEY_KP_SUBTRACT, /* 4f */ KEY_UNKNOWN, diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp index bffacb3a82d..83e2af72b28 100644 --- a/platform/windows/key_mapping_win.cpp +++ b/platform/windows/key_mapping_win.cpp @@ -44,7 +44,7 @@ static _WinTranslatePair _vk_to_keycode[] = { //VK_CLEAR (0x0C) - { KEY_RETURN, VK_RETURN }, //(0x0D) + { KEY_ENTER, VK_RETURN }, //(0x0D) { KEY_SHIFT, VK_SHIFT }, //(0x10) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index da14d5c284e..a7e7bcd883d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -807,7 +807,7 @@ void OS_Windows::process_key_events() { if ((ke.lParam & (1 << 24)) && (ke.wParam == VK_RETURN)) { // Special case for Numpad Enter key - k->set_scancode(KEY_ENTER); + k->set_scancode(KEY_KP_ENTER); } else { k->set_scancode(KeyMappingWindows::get_keysym(ke.wParam)); } diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp index 1d7eb1692c3..32a9806b221 100644 --- a/platform/x11/key_mapping_x11.cpp +++ b/platform/x11/key_mapping_x11.cpp @@ -44,7 +44,7 @@ static _XTranslatePair _xkeysym_to_keycode[] = { { XK_Tab, KEY_TAB }, { XK_ISO_Left_Tab, KEY_BACKTAB }, { XK_BackSpace, KEY_BACKSPACE }, - { XK_Return, KEY_RETURN }, + { XK_Return, KEY_ENTER }, { XK_Insert, KEY_INSERT }, { XK_Delete, KEY_DELETE }, { XK_Clear, KEY_DELETE }, @@ -78,7 +78,7 @@ static _XTranslatePair _xkeysym_to_keycode[] = { { XK_Help, KEY_HELP }, { XK_KP_Space, KEY_SPACE }, { XK_KP_Tab, KEY_TAB }, - { XK_KP_Enter, KEY_ENTER }, + { XK_KP_Enter, KEY_KP_ENTER }, { XK_Home, KEY_HOME }, { XK_Left, KEY_LEFT }, { XK_Up, KEY_UP }, diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index f4dd3e92cd9..8556ce5db11 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -229,8 +229,8 @@ void LineEdit::_gui_input(Ref p_event) { bool handled = true; switch (code) { - case KEY_ENTER: - case KEY_RETURN: { + case KEY_KP_ENTER: + case KEY_ENTER: { emit_signal("text_entered", text); if (OS::get_singleton()->has_virtual_keyboard()) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index f59a2e06eb9..b673f9d68a6 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -249,8 +249,8 @@ void PopupMenu::_gui_input(const Ref &p_event) { } } } break; - case KEY_RETURN: - case KEY_ENTER: { + case KEY_ENTER: + case KEY_KP_ENTER: { if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2fc3204f3a3..a7c31361e80 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1805,7 +1805,7 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { return; } - if (k->get_scancode() == KEY_ENTER || k->get_scancode() == KEY_RETURN || k->get_scancode() == KEY_TAB) { + if (k->get_scancode() == KEY_KP_ENTER || k->get_scancode() == KEY_ENTER || k->get_scancode() == KEY_TAB) { _confirm_completion(); accept_event(); @@ -1974,8 +1974,8 @@ void TextEdit::_gui_input(const Ref &p_gui_input) { switch (k->get_scancode()) { - case KEY_ENTER: - case KEY_RETURN: { + case KEY_KP_ENTER: + case KEY_ENTER: { if (readonly) break; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 0b57841be7b..9499ba9dcd9 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1917,8 +1917,8 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool void Tree::_text_editor_modal_close() { if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE) || - Input::get_singleton()->is_key_pressed(KEY_ENTER) || - Input::get_singleton()->is_key_pressed(KEY_RETURN)) { + Input::get_singleton()->is_key_pressed(KEY_KP_ENTER) || + Input::get_singleton()->is_key_pressed(KEY_ENTER)) { return; } @@ -2237,8 +2237,8 @@ void Tree::_gui_input(Ref p_event) { } break; case KEY_F2: - case KEY_RETURN: - case KEY_ENTER: { + case KEY_ENTER: + case KEY_KP_ENTER: { if (selected_item) { //bring up editor if possible