diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index c7ec58177..4501b8f7e 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -102,6 +102,9 @@ Other changes: Docking+Viewports Branch: +- Viewports: Fixed window inner clipping rectangle off by one when window is located on a monitor + with negative coordinates. While it is expected that other small issues with arise from this + situation, at the moment we are fixing the most noticeable one. (#6861, #2884) [@Vuhdo, @alektron] - Docking: Fixed an issue leading to incorrect restoration of selected tab in dock nodes that don't carry the currently focused window. (#2304) - Docking: added ImGuiDockNodeFlags_NoUndocking. (#2999, #6823, #6780, #3492) diff --git a/imgui.cpp b/imgui.cpp index cf12c099d..73dd9ebab 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7155,10 +7155,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Affected by window/frame border size. Used by: // - Begin() initial clip rect float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize); - window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize)); - window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + top_border_size); - window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize)); - window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize); + window->InnerClipRect.Min.x = ImFloorSigned(0.5f + window->InnerRect.Min.x + ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize)); + window->InnerClipRect.Min.y = ImFloorSigned(0.5f + window->InnerRect.Min.y + top_border_size); + window->InnerClipRect.Max.x = ImFloorSigned(0.5f + window->InnerRect.Max.x - ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize)); + window->InnerClipRect.Max.y = ImFloorSigned(0.5f + window->InnerRect.Max.y - window->WindowBorderSize); window->InnerClipRect.ClipWithFull(host_rect); // Default item width. Make it proportional to window size if window manually resizes