From 64519c6875fde64796aa1d098c02e1b346ac99fe Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 22 Feb 2022 16:21:10 +0100 Subject: [PATCH] Docking: Fixed floating docked nodes not being clamped into viewport workrect to stay reachable when g.ConfigWindowsMoveFromTitleBarOnly is set and multi-viewports are disabled. (#5044) --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index a11c8c12b..9fd364eb4 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -132,6 +132,8 @@ Other Changes: Docking+Viewports Branch: +- Docking: Fixed floating docked nodes not being clamped into viewport workrect to stay reachable + when g.ConfigWindowsMoveFromTitleBarOnly is set and multi-viewports are disabled. (#5044) - Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (#4900) diff --git a/imgui.cpp b/imgui.cpp index 20774780a..35c7c9ef3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6015,8 +6015,8 @@ static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& visibility { ImGuiContext& g = *GImGui; ImVec2 size_for_clamping = window->Size; - if (g.IO.ConfigWindowsMoveFromTitleBarOnly && !(window->Flags & ImGuiWindowFlags_NoTitleBar)) - size_for_clamping.y = window->TitleBarHeight(); + if (g.IO.ConfigWindowsMoveFromTitleBarOnly && (!(window->Flags & ImGuiWindowFlags_NoTitleBar) || window->DockNodeAsHost)) + size_for_clamping.y = ImGui::GetFrameHeight(); // Not using window->TitleBarHeight() as DockNodeAsHost will report 0.0f here. window->Pos = ImClamp(window->Pos, visibility_rect.Min - size_for_clamping, visibility_rect.Max); }