From a66742d699b559417e0d1e7a89b5a1704c5e4a7f Mon Sep 17 00:00:00 2001 From: Brendan LeVoy Date: Tue, 3 Feb 2026 14:20:54 -0500 Subject: [PATCH] Skip setting current dock when tab cannot switch When opening a dock into a DockTabContainer that returns can_switch_dock() == false, avoid marking the dock as current. Previously p_set_current was passed through to _move_dock unconditionally; now we cast the slot to DockTabContainer and force set_current to false if switching is disallowed, preventing an unwanted focus/tab switch. Fixed random whitespace issue to satisfy clang format Squashes: Update editor_dock_manager.cpp Simplify 3rd arg of _mode_dock call Change type of slot to remove redundancy Co-Authored-By: lodetrick <146759331+lodetrick@users.noreply.github.com> --- editor/docks/editor_dock_manager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editor/docks/editor_dock_manager.cpp b/editor/docks/editor_dock_manager.cpp index 2446b8a7e0f..117e50a5017 100644 --- a/editor/docks/editor_dock_manager.cpp +++ b/editor/docks/editor_dock_manager.cpp @@ -603,12 +603,13 @@ void EditorDockManager::open_dock(EditorDock *p_dock, bool p_set_current) { // Open dock to its previous location. if (p_dock->dock_slot_index != EditorDock::DOCK_SLOT_NONE) { - TabContainer *slot = dock_slots[p_dock->dock_slot_index]; + DockTabContainer *slot = dock_slots[p_dock->dock_slot_index]; int tab_index = p_dock->previous_tab_index; if (tab_index < 0) { tab_index = slot->get_tab_count(); } - _move_dock(p_dock, slot, tab_index, p_set_current); + + _move_dock(p_dock, slot, tab_index, p_set_current && slot->can_switch_dock()); } else { _open_dock_in_window(p_dock, true, true); return;