Skip to content

Commit cf313e4

Browse files
committed
Merge pull request #96786 from passivestar/spin-slider-focus-fix
Fix EditorSpinSlider blocking viewport from getting focus
2 parents 955c056 + 16f3d52 commit cf313e4

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

editor/gui/editor_spin_slider.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#include "editor/themes/editor_scale.h"
3838
#include "scene/theme/theme_db.h"
3939

40-
bool EditorSpinSlider::is_text_field() const {
41-
return true;
42-
}
43-
4440
String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
4541
if (!read_only && grabber->is_visible()) {
4642
Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL;

editor/gui/editor_spin_slider.h

-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ class EditorSpinSlider : public Range {
101101
void _focus_entered();
102102

103103
public:
104-
virtual bool is_text_field() const override;
105-
106104
String get_tooltip(const Point2 &p_pos) const override;
107105

108106
String get_text_value() const;

editor/scene_tree_dock.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,12 @@ void SceneTreeDock::shortcut_input(const Ref<InputEvent> &p_event) {
156156
}
157157

158158
if (ED_IS_SHORTCUT("scene_tree/rename", p_event)) {
159-
// Prevent renaming if a button is focused
160-
// to avoid conflict with Enter shortcut on macOS
161-
if (!focus_owner || !Object::cast_to<BaseButton>(focus_owner)) {
162-
_tool_selected(TOOL_RENAME);
159+
// Prevent renaming if a button or a range is focused
160+
// to avoid conflict with Enter shortcut on macOS.
161+
if (focus_owner && (Object::cast_to<BaseButton>(focus_owner) || Object::cast_to<Range>(focus_owner))) {
162+
return;
163163
}
164+
_tool_selected(TOOL_RENAME);
164165
#ifdef MODULE_REGEX_ENABLED
165166
} else if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
166167
_tool_selected(TOOL_BATCH_RENAME);

0 commit comments

Comments
 (0)