Windows: Scrollbar visibility decision uses current size when both size and contents size are submitted by API. (#7252)
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 48ccc0c..3468c0a 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -41,6 +41,8 @@
Other changes:
+- Windows: Scrollbar visibility decision uses current size when both size and contents
+ size are submitted by API. (#7252)
- Menus, Popups: Fixed an issue where sibling menu popups re-opening in successive
frames would erroneously close the window. While it is technically a popup issue
it would generally manifest when fast moving the mouse bottom to top in a sub-menu.
diff --git a/imgui.cpp b/imgui.cpp
index 6a14012..45d551a 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -6610,8 +6610,14 @@
window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x);
window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y;
+ // Depending on condition we use previous or current window size to compare against contents size to decide if a scrollbar should be visible.
+ // Those flags will be altered further down in the function depending on more conditions.
bool use_current_size_for_scrollbar_x = window_just_created;
bool use_current_size_for_scrollbar_y = window_just_created;
+ if (window_size_x_set_by_api && window->ContentSizeExplicit.x != 0.0f)
+ use_current_size_for_scrollbar_x = true;
+ if (window_size_y_set_by_api && window->ContentSizeExplicit.y != 0.0f) // #7252
+ use_current_size_for_scrollbar_y = true;
// Collapse window by double-clicking on title bar
// At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing
diff --git a/imgui.h b/imgui.h
index 307834f..cd707b4 100644
--- a/imgui.h
+++ b/imgui.h
@@ -24,7 +24,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.5 WIP"
-#define IMGUI_VERSION_NUM 19042
+#define IMGUI_VERSION_NUM 19043
#define IMGUI_HAS_TABLE
/*