From a2487bc1432925f33c5fc5ffe67bbd69bc31b5e1 Mon Sep 17 00:00:00 2001 From: ocornut Date: Sat, 1 Oct 2016 15:16:17 +0200 Subject: [PATCH] Minor tweaks --- imgui.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 5157a2cd..063ab487 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4072,7 +4072,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us if (window_pos_center) { // Center (any sort of window) - SetWindowPos(ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f)); + SetWindowPos(window, ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f), 0); } else if (flags & ImGuiWindowFlags_ChildMenu) { @@ -4870,14 +4870,13 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond) { - ImGuiWindow* window = GetCurrentWindow(); + ImGuiWindow* window = GetCurrentWindowRead(); SetWindowPos(window, pos, cond); } void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond) { - ImGuiWindow* window = FindWindowByName(name); - if (window) + if (ImGuiWindow* window = FindWindowByName(name)) SetWindowPos(window, pos, cond); }