Windows: Changed default ClipRect to extend to windows' left and right borders. (#3312, #7540, #3756, #6170, #6365)
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index af03322..224248f 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -56,6 +56,12 @@
Other changes:
+- Windows: Changed default ClipRect to extend to windows' left and right borders,
+ instead of adding arbitrary WindowPadding.x * 0.5f space on left and right.
+ That ClipRect half-padding was arbitrary/confusing and inconsistent with Y axis.
+ It also made it harder to draw items covering whole window without pushing an
+ extended ClipRect. Some items near windows left and right edge that used to be clipped
+ may be partly more visible. (#3312, #7540, #3756, #6170, #6365)
- Windows: Fixed subsequent Begin() append calls from setting last item information
for title bar, making it impossible to use IsItemHovered() on a Begin()-to-append,
and causing issue bypassing hover detection on collapsed windows. (#7506, #823)
diff --git a/imgui.cpp b/imgui.cpp
index c4fd19c..750c9c9 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -6838,16 +6838,18 @@
window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->DecoOuterSizeY2;
// Inner clipping rectangle.
- // Will extend a little bit outside the normal work region.
- // This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
- // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
+ // - Extend a outside of normal work region up to borders.
+ // - This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
+ // - It also makes clipped items be more noticeable.
+ // - And is consistent on both axis (prior to 2024/05/03 ClipRect used WindowPadding.x * 0.5f on left and right edge), see #3312
+ // - Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
// 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(ImTrunc(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
+ window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + 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(ImTrunc(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
+ window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - window->WindowBorderSize);
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);
window->InnerClipRect.ClipWithFull(host_rect);
diff --git a/imgui.h b/imgui.h
index e72de81..ea5976f 100644
--- a/imgui.h
+++ b/imgui.h
@@ -28,7 +28,7 @@
// Library Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
#define IMGUI_VERSION "1.90.6 WIP"
-#define IMGUI_VERSION_NUM 19053
+#define IMGUI_VERSION_NUM 19054
#define IMGUI_HAS_TABLE
/*