Fixed window inner clipping rectangle off by one when window is located on a monitor with negative coordinates. (#6861, #2884)

This commit is contained in:
ocornut 2023-09-25 20:45:34 +02:00
parent 2c0007731f
commit c418685315
2 changed files with 7 additions and 4 deletions

View File

@ -102,6 +102,9 @@ Other changes:
Docking+Viewports Branch: 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 - Docking: Fixed an issue leading to incorrect restoration of selected tab in dock nodes that
don't carry the currently focused window. (#2304) don't carry the currently focused window. (#2304)
- Docking: added ImGuiDockNodeFlags_NoUndocking. (#2999, #6823, #6780, #3492) - Docking: added ImGuiDockNodeFlags_NoUndocking. (#2999, #6823, #6780, #3492)

View File

@ -7155,10 +7155,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Affected by window/frame border size. Used by: // Affected by window/frame border size. Used by:
// - Begin() initial clip rect // - Begin() initial clip rect
float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize); 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.x = ImFloorSigned(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.Min.y = ImFloorSigned(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.x = ImFloorSigned(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.Max.y = ImFloorSigned(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);
window->InnerClipRect.ClipWithFull(host_rect); window->InnerClipRect.ClipWithFull(host_rect);
// Default item width. Make it proportional to window size if window manually resizes // Default item width. Make it proportional to window size if window manually resizes