diff --git a/imgui.cpp b/imgui.cpp index e82eefc9..b4689e46 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3172,7 +3172,14 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window) SetActiveID(window->MoveId, window); g.NavDisableHighlight = true; g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos; - if (!(window->Flags & ImGuiWindowFlags_NoMove) && !(window->RootWindow->Flags & ImGuiWindowFlags_NoMove)) + + bool can_move_window = true; + if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove)) + can_move_window = false; + if (ImGuiDockNode* node = window->DockNodeAsHost) + if (node->VisibleWindow && (node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove)) + can_move_window = false; + if (can_move_window) g.MovingWindow = window; } @@ -11064,7 +11071,7 @@ static void ImGui::DockNodeStartMouseMovingWindow(ImGuiDockNode* node, ImGuiWind IM_ASSERT(node->WantMouseMove == true); ImVec2 backup_active_click_offset = g.ActiveIdClickOffset; StartMouseMovingWindow(window); - g.MovingWindow = window; // If we are docked into a non moveable root widnow, StartMouseMovingWindow() won't set g.MovingWindow. OVerride that decision. + g.MovingWindow = window; // If we are docked into a non moveable root window, StartMouseMovingWindow() won't set g.MovingWindow. Override that decision. node->WantMouseMove = false; g.ActiveIdClickOffset = backup_active_click_offset; } @@ -11533,6 +11540,8 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w if (IsMouseClicked(0)) { focus_tab_id = tab_bar->SelectedTabId; + + // Forward moving request to selected window if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, focus_tab_id)) StartMouseMovingWindow(tab->Window); } diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 53bbbd0b..395d4dad 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -712,7 +712,7 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos, ImGuiDockNode* dock_no if (IsItemActive() && IsMouseDragging(0)) { bool can_extract_dock_node = false; - if (dock_node != NULL) + if (dock_node != NULL && dock_node->VisibleWindow && !(dock_node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove)) { ImGuiDockNode* root_node = DockNodeGetRootNode(dock_node); if (root_node->OnlyNodeWithWindows != dock_node || (root_node->CentralNode != NULL))