WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0b30947

Browse files
committed
Windows: Changed default ClipRect to extend to windows' left and right borders. (#3312, #7540, #3756, #6170, #6365)
1 parent 0c9c12c commit 0b30947

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

docs/CHANGELOG.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ Breaking changes:
5656

5757
Other changes:
5858

59+
- Windows: Changed default ClipRect to extend to windows' left and right borders,
60+
instead of adding arbitrary WindowPadding.x * 0.5f space on left and right.
61+
That ClipRect half-padding was arbitrary/confusing and inconsistent with Y axis.
62+
It also made it harder to draw items covering whole window without pushing an
63+
extended ClipRect. Some items near windows left and right edge that used to be clipped
64+
may be partly more visible. (#3312, #7540, #3756, #6170, #6365)
5965
- Windows: Fixed subsequent Begin() append calls from setting last item information
6066
for title bar, making it impossible to use IsItemHovered() on a Begin()-to-append,
6167
and causing issue bypassing hover detection on collapsed windows. (#7506, #823)

imgui.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6838,16 +6838,18 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
68386838
window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->DecoOuterSizeY2;
68396839

68406840
// Inner clipping rectangle.
6841-
// Will extend a little bit outside the normal work region.
6842-
// This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
6843-
// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
6841+
// - Extend a outside of normal work region up to borders.
6842+
// - This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
6843+
// - It also makes clipped items be more noticeable.
6844+
// - And is consistent on both axis (prior to 2024/05/03 ClipRect used WindowPadding.x * 0.5f on left and right edge), see #3312
6845+
// - Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
68446846
// Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
68456847
// Affected by window/frame border size. Used by:
68466848
// - Begin() initial clip rect
68476849
float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
6848-
window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(ImTrunc(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
6850+
window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + window->WindowBorderSize);
68496851
window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + top_border_size);
6850-
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(ImTrunc(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
6852+
window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - window->WindowBorderSize);
68516853
window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);
68526854
window->InnerClipRect.ClipWithFull(host_rect);
68536855

imgui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// Library Version
2929
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
3030
#define IMGUI_VERSION "1.90.6 WIP"
31-
#define IMGUI_VERSION_NUM 19053
31+
#define IMGUI_VERSION_NUM 19054
3232
#define IMGUI_HAS_TABLE
3333

3434
/*

0 commit comments

Comments
 (0)