From 152ee66a048b8747091059070cd267f41abe464e Mon Sep 17 00:00:00 2001 From: Zachary Hall Date: Wed, 15 Jan 2025 12:45:17 -0800 Subject: [PATCH] Fix using addition instead of subtraction for right alignment of titlebar buttons. --- backends/ui/imgui/RendererBackend.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/ui/imgui/RendererBackend.cpp b/backends/ui/imgui/RendererBackend.cpp index 4063f8a..bca0d1f 100644 --- a/backends/ui/imgui/RendererBackend.cpp +++ b/backends/ui/imgui/RendererBackend.cpp @@ -508,11 +508,11 @@ void RendererBackend::EndMainMenuBar() { float padding = ImGui::GetStyle().FramePadding.x; float spacing = ImGui::GetStyle().ItemSpacing.x; for (size_t i = 0; i < titlebar_btn_count; i++) { - tmp += padding; + tmp -= padding; // No need to use the correct index, as long as this is hit only once. - if (i == 0) tmp += spacing / 2; - else tmp += spacing; - tmp += ImGui::CalcTextSize(titlebar_icons[i]).x; + if (i == 0) tmp -= spacing / 2.0f; + else tmp -= spacing; + tmp -= ImGui::CalcTextSize(titlebar_icons[i]).x; } title_btn_start = std::ceil(tmp); ImGui::SetCursorPosX(title_btn_start);