From 7ac1eb3fd47fd9533eff5a6b5cbd5c21470b4eb1 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 12 May 2026 20:42:17 +0200 Subject: [PATCH] fix(ui): pass measured width straight through IconButton, drop broken subtract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inspired by ChatTwo upstream f35b7d3 (Infiziert90, 2026-05-12). Upstream dropped the width parameter entirely because nothing called it. We keep the parameter — two ChatLogWindow header buttons (Cog, EyeSlash) size themselves to match the preceding ChannelIcon button. The actual bug is local: the previous size = width - 2 * CellPadding.X mixed a raw int (HUD-scale unaware) with CellPadding.X (HUD-scaled), so the button shrank under elevated HUD scale. ImGui.Button handles its own frame padding internally, so the measured width passes through unchanged. --- HellionChat/Util/ImGuiUtil.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/HellionChat/Util/ImGuiUtil.cs b/HellionChat/Util/ImGuiUtil.cs index 96cd830..4db4141 100755 --- a/HellionChat/Util/ImGuiUtil.cs +++ b/HellionChat/Util/ImGuiUtil.cs @@ -254,6 +254,17 @@ internal static class ImGuiUtil return end; } + // --------------------------------------------------------------- + // Inspired by ChatTwo upstream f35b7d3 (Infiziert90, 2026-05-12). + // Upstream dropped the width parameter (no callers there); we keep + // it because two ChatLogWindow header buttons size themselves to + // match the ChannelIcon button's frame. The actual bug is the + // manual size = width - 2 * CellPadding.X subtraction: CellPadding + // scales with HUD scale, the raw int does not, so the button + // shrank under high HUD scales. ImGui.Button already handles its + // own frame padding internally — pass the measured width straight + // through. + // --------------------------------------------------------------- internal static bool IconButton( FontAwesomeIcon icon, string? id = null, @@ -268,10 +279,7 @@ internal static class ImGuiUtil bool ret; using (Plugin.FontManager.FontAwesome.Push()) { - var size = Vector2.Zero; - if (width > 0) - size.X = width - 2 * ImGui.GetStyle().CellPadding.X; - + var size = width > 0 ? new Vector2(width, 0f) : Vector2.Zero; ret = ImGui.Button(label, size); }