From 1b2db4c698a4e0aba743ae2b76a92a5ea3f3c3d3 Mon Sep 17 00:00:00 2001 From: cake Date: Thu, 11 Dec 2025 05:38:35 +0100 Subject: [PATCH] Fixed pushes to imgui styles so its contained to only admin panel. --- LightlessSync/UI/SyncshellAdminUI.cs | 73 ++++++++++++++++------------ 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/LightlessSync/UI/SyncshellAdminUI.cs b/LightlessSync/UI/SyncshellAdminUI.cs index 66765d4..5830e1f 100644 --- a/LightlessSync/UI/SyncshellAdminUI.cs +++ b/LightlessSync/UI/SyncshellAdminUI.cs @@ -454,52 +454,63 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase var style = ImGui.GetStyle(); - ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(10f, 5f) * ImGuiHelpers.GlobalScale); - ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(8f, style.ItemSpacing.Y)); - ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 5f * ImGuiHelpers.GlobalScale); - var baseTab = UIColors.Get("FullBlack").WithAlpha(0.0f); var baseTabDim = UIColors.Get("FullBlack").WithAlpha(0.1f); var accent = UIColors.Get("LightlessPurple"); var accentHover = accent.WithAlpha(0.90f); var accentActive = accent; - ImGui.PushStyleColor(ImGuiCol.Tab, baseTab); - ImGui.PushStyleColor(ImGuiCol.TabHovered, accentHover); - ImGui.PushStyleColor(ImGuiCol.TabActive, accentActive); - ImGui.PushStyleColor(ImGuiCol.TabUnfocused, baseTabDim); - ImGui.PushStyleColor(ImGuiCol.TabUnfocusedActive, accentActive.WithAlpha(0.80f)); + //Pushing style vars for inner tab bar + ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(10f, 5f) * ImGuiHelpers.GlobalScale); + ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(8f, style.ItemSpacing.Y)); + ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 5f * ImGuiHelpers.GlobalScale); - using (var innerTabBar = ImRaii.TabBar("user_mgmt_inner_tab_" + GroupFullInfo.GID)) + try { - if (innerTabBar) + //Pushing color stack for inner tab bar + using (ImRaii.PushColor(ImGuiCol.Tab, baseTab)) + using (ImRaii.PushColor(ImGuiCol.TabHovered, accentHover)) + using (ImRaii.PushColor(ImGuiCol.TabActive, accentActive)) + using (ImRaii.PushColor(ImGuiCol.TabUnfocused, baseTabDim)) + using (ImRaii.PushColor(ImGuiCol.TabUnfocusedActive, accentActive.WithAlpha(0.80f))) { - // Users tab - var usersTab = ImRaii.TabItem("Users"); - if (usersTab) + using (var innerTabBar = ImRaii.TabBar("syncshell_tab_" + GroupFullInfo.GID)) { - DrawUserListSection(); - } - usersTab.Dispose(); + if (innerTabBar) + { + // Users tab + var usersTab = ImRaii.TabItem("Users"); + if (usersTab) + { + DrawUserListSection(); + } + usersTab.Dispose(); - // Cleanup tab - var cleanupTab = ImRaii.TabItem("Cleanup"); - if (cleanupTab) - { - DrawMassCleanupSection(); - } - cleanupTab.Dispose(); + // Cleanup tab + var cleanupTab = ImRaii.TabItem("Cleanup"); + if (cleanupTab) + { + DrawMassCleanupSection(); + } + cleanupTab.Dispose(); - // Bans tab - var bansTab = ImRaii.TabItem("Bans"); - if (bansTab) - { - DrawUserBansSection(); + // Bans tab + var bansTab = ImRaii.TabItem("Bans"); + if (bansTab) + { + DrawUserBansSection(); + } + bansTab.Dispose(); + } } - bansTab.Dispose(); } + mgmtTab.Dispose(); + } + finally + { + // Popping style vars (3) for inner tab bar + ImGui.PopStyleVar(3); } - mgmtTab.Dispose(); } private void DrawUserListSection()