From f5d185238c38de5df131df6edca5dd2bc556841b Mon Sep 17 00:00:00 2001 From: cfillion Date: Fri, 3 May 2024 17:44:18 +0200 Subject: [PATCH] Viewports: fixed outer-right edge of MenuBar clipping rectangle off by one when window is located on a monitor with negative coordinates. (#6861, #2884) --- docs/CHANGELOG.txt | 2 ++ imgui_widgets.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index d678ff15f..db4e54f97 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -93,6 +93,8 @@ Docking+Viewports Branch: - Docking: when io.ConfigDockingWithShift is enabled, fixed help tooltip erroneously reading SetNextWindowXXX() data. (#6709, #4643, #7491) [@ocornut, @cfillion] +- Viewports: fixed outer-right edge of MenuBar clipping rectangle off by one when window + is located on a monitor with negative coordinates. (#6861, #2884) [@cfillion] - Backends: Vulkan: create a custom pipeline for secondary viewports. Fixes issues when user created main viewport uses a different renderpass. (#6325, #6305, #7398, #3459, #3253, #3522) [@skaman, @FunMiles] diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 2ec39b7ac..2c1a4d47f 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7309,7 +7309,7 @@ bool ImGui::BeginMenuBar() // We don't clip with current window clipping rectangle as it is already set to the area below. However we clip with window full rect. // We remove 1 worth of rounding to Max.x to that text in long menus and small windows don't tend to display over the lower-right rounded area, which looks particularly glitchy. ImRect bar_rect = window->MenuBarRect(); - ImRect clip_rect(IM_ROUND(bar_rect.Min.x + window->WindowBorderSize), IM_ROUND(bar_rect.Min.y + window->WindowBorderSize), IM_ROUND(ImMax(bar_rect.Min.x, bar_rect.Max.x - ImMax(window->WindowRounding, window->WindowBorderSize))), IM_ROUND(bar_rect.Max.y)); + ImRect clip_rect(ImFloor(bar_rect.Min.x + window->WindowBorderSize), ImFloor(bar_rect.Min.y + window->WindowBorderSize), ImFloor(ImMax(bar_rect.Min.x, bar_rect.Max.x - ImMax(window->WindowRounding, window->WindowBorderSize))), ImFloor(bar_rect.Max.y)); clip_rect.ClipWith(window->OuterRectClipped); PushClipRect(clip_rect.Min, clip_rect.Max, false);