Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Improve dock tab focus

kobewi504d9f2b2ba1
diff --git a/editor/docks/editor_dock_manager.cpp b/editor/docks/editor_dock_manager.cpp
index 6adffeb6472..03d2c36dbc1 100644
--- a/editor/docks/editor_dock_manager.cpp
+++ b/editor/docks/editor_dock_manager.cpp
@@ -722,7 +722,7 @@ void EditorDockManager::_make_dock_visible(EditorDock *p_dock, bool p_grab_focus
}
if (p_grab_focus) {
- tab_container->get_tab_bar()->grab_focus();
+ tab_container->get_tab_bar()->grab_focus(true);
}
if (!p_dock->is_visible_in_tree()) {
diff --git a/editor/themes/theme_classic.cpp b/editor/themes/theme_classic.cpp
index ffc0de6c28a..8156f4aa7e1 100644
--- a/editor/themes/theme_classic.cpp
+++ b/editor/themes/theme_classic.cpp
@@ -1764,7 +1764,6 @@ void ThemeClassic::populate_editor_styles(const Ref<EditorTheme> &p_theme, Edito
p_theme->set_stylebox("tabbar_background", "BottomPanel", style_bottom_panel_tabbar);
p_theme->set_stylebox("tab_selected", "BottomPanel", style_bottom_tab_selected);
p_theme->set_stylebox("tab_hovered", "BottomPanel", style_bottom_tab_hover);
- p_theme->set_stylebox("tab_focus", "BottomPanel", menu_transparent_style);
p_theme->set_stylebox("tab_unselected", "BottomPanel", style_bottom_tab);
p_theme->set_color("font_unselected_color", "BottomPanel", p_config.font_color);
p_theme->set_color("font_hovered_color", "BottomPanel", p_config.font_hover_color);
diff --git a/editor/themes/theme_modern.cpp b/editor/themes/theme_modern.cpp
index 01bc59be64f..c26a28e17f1 100644
--- a/editor/themes/theme_modern.cpp
+++ b/editor/themes/theme_modern.cpp
@@ -1812,7 +1812,6 @@ void ThemeModern::populate_editor_styles(const Ref<EditorTheme> &p_theme, Editor
p_theme->set_stylebox("tabbar_background", "BottomPanel", style_bottom_panel_tabbar);
p_theme->set_stylebox("tab_selected", "BottomPanel", bottom_panel_button_pressed);
p_theme->set_stylebox("tab_hovered", "BottomPanel", bottom_panel_button_hover);
- p_theme->set_stylebox("tab_focus", "BottomPanel", p_config.base_empty_style);
p_theme->set_stylebox("tab_unselected", "BottomPanel", style_bottom_tab);
p_theme->set_color("font_unselected_color", "BottomPanel", p_config.font_color);
p_theme->set_color("font_hovered_color", "BottomPanel", p_config.font_hover_color);
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp
index 81dad49a3f0..ea53b50b7f7 100644
--- a/scene/gui/tab_bar.cpp
+++ b/scene/gui/tab_bar.cpp
@@ -341,6 +341,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventJoypadButton> joypadbutton_event = p_event;
bool is_joypad_event = (joypadmotion_event.is_valid() || joypadbutton_event.is_valid());
if (p_event->is_action("ui_right", true)) {
+ grab_focus(); // Ensure focus is visible.
if (is_joypad_event) {
if (!input->is_action_just_pressed_by_event("ui_right", p_event, true)) {
return;
@@ -351,6 +352,7 @@ void TabBar::gui_input(const Ref<InputEvent> &p_event) {
accept_event();
}
} else if (p_event->is_action("ui_left", true)) {
+ grab_focus();
if (is_joypad_event) {
if (!input->is_action_just_pressed_by_event("ui_left", p_event, true)) {
return;