From 76e40fe5d1059733ddcdd88236ee5c5743ed64b7 Mon Sep 17 00:00:00 2001 From: omar Date: Sat, 20 Jun 2020 22:06:44 +0200 Subject: [PATCH] Docking: Fix misuse of PushClipRect in UpdateWindowManualResize(). (#3311) --- imgui.cpp | 5 ++--- imgui.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index ff6722af8..08c86496d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5502,9 +5502,10 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s // This is however not the case with current back-ends under Win32, but a custom borderless window implementation would benefit from it. // - When decoration are enabled we typically benefit from that distance, but then our resize elements would be conflicting with OS resize elements, so we also narrow. // - Note that we are unable to tell if the platform setup allows hovering with a distance threshold (on Win32, decorated window have such threshold). + // We only clip interaction so we overwrite window->ClipRect, cannot call PushClipRect() yet as DrawList is not yet setup. const bool clip_with_viewport_rect = !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseHoveredViewport) || (g.IO.MouseHoveredViewport != window->ViewportId) || !(window->Viewport->Flags & ImGuiViewportFlags_NoDecoration); if (clip_with_viewport_rect) - PushClipRect(window->Viewport->Pos, window->Viewport->Pos + window->Viewport->Size, true); // Won't incur a draw command as we are not drawing here. + window->ClipRect = window->Viewport->GetMainRect(); // Resize grips and borders are on layer 1 window->DC.NavLayerCurrent = ImGuiNavLayer_Menu; @@ -5568,8 +5569,6 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s } } PopID(); - if (clip_with_viewport_rect) - PopClipRect(); // Restore nav layer window->DC.NavLayerCurrent = ImGuiNavLayer_Main; diff --git a/imgui.h b/imgui.h index 980fbf165..c283070f7 100644 --- a/imgui.h +++ b/imgui.h @@ -1697,7 +1697,7 @@ struct ImGuiSizeCallbackData // Important: the content of this class is still highly WIP and likely to change and be refactored // before we stabilize Docking features. Please be mindful if using this. // Provide hints: -// - To the platform back-end via altered viewport flags (enable/disable OS decoration, OS task bar icons, etc.) +// - To the platform back-end via altered viewport flags (enable/disable OS decoration, OS task bar icons, etc.) // - To the platform back-end for OS level parent/child relationships of viewport. // - To the docking system for various options and filtering. struct ImGuiWindowClass @@ -1707,7 +1707,7 @@ struct ImGuiWindowClass ImGuiViewportFlags ViewportFlagsOverrideSet; // Viewport flags to set when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis. ImGuiViewportFlags ViewportFlagsOverrideClear; // Viewport flags to clear when a window of this class owns a viewport. This allows you to enforce OS decoration or task bar icon, override the defaults on a per-window basis. ImGuiDockNodeFlags DockNodeFlagsOverrideSet; // [EXPERIMENTAL] Dock node flags to set when a window of this class is hosted by a dock node (it doesn't have to be selected!) - ImGuiDockNodeFlags DockNodeFlagsOverrideClear; // [EXPERIMENTAL] + ImGuiDockNodeFlags DockNodeFlagsOverrideClear; // [EXPERIMENTAL] bool DockingAlwaysTabBar; // Set to true to enforce single floating windows of this class always having their own docking node (equivalent of setting the global io.ConfigDockingAlwaysTabBar) bool DockingAllowUnclassed; // Set to true to allow windows of this class to be docked/merged with an unclassed window.