fix(ui): pass measured width straight through IconButton, drop broken subtract

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.
This commit is contained in:
2026-05-12 20:42:17 +02:00
parent db48f27842
commit 7ac1eb3fd4
+12 -4
View File
@@ -254,6 +254,17 @@ internal static class ImGuiUtil
return end; 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( internal static bool IconButton(
FontAwesomeIcon icon, FontAwesomeIcon icon,
string? id = null, string? id = null,
@@ -268,10 +279,7 @@ internal static class ImGuiUtil
bool ret; bool ret;
using (Plugin.FontManager.FontAwesome.Push()) using (Plugin.FontManager.FontAwesome.Push())
{ {
var size = Vector2.Zero; var size = width > 0 ? new Vector2(width, 0f) : Vector2.Zero;
if (width > 0)
size.X = width - 2 * ImGui.GetStyle().CellPadding.X;
ret = ImGui.Button(label, size); ret = ImGui.Button(label, size);
} }