summaryrefslogtreecommitdiffstats
path: root/editor/scene_tree_dock.cpp
diff options
context:
space:
mode:
authorpassivestar <60579014+passivestar@users.noreply.github.com>2024-06-14 18:44:06 +0400
committerpassivestar <60579014+passivestar@users.noreply.github.com>2024-07-09 16:29:35 +0400
commit09f967bc00b5d8ed6e71e071aa891d39e56092e8 (patch)
tree99eb1b32e0f860da42985d3d5228a2e86053c14f /editor/scene_tree_dock.cpp
parent71699e08c9df78b7203fa4ef9cede28e995d6ace (diff)
downloadredot-engine-09f967bc00b5d8ed6e71e071aa891d39e56092e8.tar.gz
Prevent node rename shortcut from stealing focus from controls
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r--editor/scene_tree_dock.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 11e477e044..aa41ec6135 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -148,7 +148,8 @@ void SceneTreeDock::input(const Ref<InputEvent> &p_event) {
void SceneTreeDock::shortcut_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
- if (get_viewport()->gui_get_focus_owner() && get_viewport()->gui_get_focus_owner()->is_text_field()) {
+ Control *focus_owner = get_viewport()->gui_get_focus_owner();
+ if (focus_owner && focus_owner->is_text_field()) {
return;
}
@@ -157,7 +158,11 @@ void SceneTreeDock::shortcut_input(const Ref<InputEvent> &p_event) {
}
if (ED_IS_SHORTCUT("scene_tree/rename", p_event)) {
- _tool_selected(TOOL_RENAME);
+ // Prevent renaming if a button is focused
+ // to avoid conflict with Enter shortcut on macOS
+ if (!focus_owner || !Object::cast_to<BaseButton>(focus_owner)) {
+ _tool_selected(TOOL_RENAME);
+ }
#ifdef MODULE_REGEX_ENABLED
} else if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
_tool_selected(TOOL_BATCH_RENAME);