Fixed calling SetNextWindowSize()/SetWindowSize() with non-integer values leading to accidental alteration of window position. We now round the provided size. (#2067)
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index b2c6a20..184a4b9 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -37,6 +37,8 @@
- Fixed calling DestroyContext() always saving .ini data with the current context instead
of the supplied context pointer. (#2066)
+- Fixed calling SetNextWindowSize()/SetWindowSize() with non-integer values leading to
+ accidental alteration of window position. We now round the provided size. (#2067)
-----------------------------------------------------------------------
diff --git a/imgui.cpp b/imgui.cpp
index f5f19df..a2dbc4d 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -4187,7 +4187,7 @@
if (ImLengthSqr(settings->Size) > 0.00001f)
size = ImFloor(settings->Size);
}
- window->Size = window->SizeFull = window->SizeFullAtLastBegin = size;
+ window->Size = window->SizeFull = window->SizeFullAtLastBegin = ImFloor(size);
window->DC.CursorMaxPos = window->Pos; // So first call to CalcSizeContents() doesn't return crazy values
if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0)
@@ -5659,7 +5659,7 @@
if (size.x > 0.0f)
{
window->AutoFitFramesX = 0;
- window->SizeFull.x = size.x;
+ window->SizeFull.x = ImFloor(size.x);
}
else
{
@@ -5669,7 +5669,7 @@
if (size.y > 0.0f)
{
window->AutoFitFramesY = 0;
- window->SizeFull.y = size.y;
+ window->SizeFull.y = ImFloor(size.y);
}
else
{