diff --git a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs index 99b51e122..fd4949533 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs @@ -152,12 +152,12 @@ internal class SettingsWindow : Window settingsTab.OnOpen(); } - if (ImGui.BeginChild($"###settings_scrolling_{settingsTab.Title}", new Vector2(-1, -1), false)) - { + using var tabChild = ImRaii.Child( + $"###settings_scrolling_{settingsTab.Title}", + new Vector2(-1, -1), + false); + if (tabChild) settingsTab.Draw(); - } - - ImGui.EndChild(); } else if (settingsTab.IsOpen) { @@ -207,33 +207,34 @@ internal class SettingsWindow : Window ImGui.SetCursorPos(windowSize - ImGuiHelpers.ScaledVector2(70)); - if (ImGui.BeginChild("###settingsFinishButton")) + using (var buttonChild = ImRaii.Child("###settingsFinishButton")) { - using var disabled = ImRaii.Disabled(this.tabs.Any(x => x.Entries.Any(y => !y.IsValid))); - - using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 100f)) + if (buttonChild) { - using var font = ImRaii.PushFont(InterfaceManager.IconFont); + using var disabled = ImRaii.Disabled(this.tabs.Any(x => x.Entries.Any(y => !y.IsValid))); - if (ImGui.Button(FontAwesomeIcon.Save.ToIconString(), new Vector2(40))) + using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 100f)) { - this.Save(); + using var font = ImRaii.PushFont(InterfaceManager.IconFont); - if (!ImGui.IsKeyDown(ImGuiKey.ModShift)) - this.IsOpen = false; + if (ImGui.Button(FontAwesomeIcon.Save.ToIconString(), new Vector2(40))) + { + this.Save(); + + if (!ImGui.IsKeyDown(ImGuiKey.ModShift)) + this.IsOpen = false; + } + } + + if (ImGui.IsItemHovered()) + { + ImGui.SetTooltip(!ImGui.IsKeyDown(ImGuiKey.ModShift) + ? Loc.Localize("DalamudSettingsSaveAndExit", "Save changes and close") + : Loc.Localize("DalamudSettingsSave", "Save changes")); } } - - if (ImGui.IsItemHovered()) - { - ImGui.SetTooltip(!ImGui.IsKeyDown(ImGuiKey.ModShift) - ? Loc.Localize("DalamudSettingsSaveAndExit", "Save changes and close") - : Loc.Localize("DalamudSettingsSave", "Save changes")); - } } - ImGui.EndChild(); - ImGui.SetCursorPos(new Vector2(windowSize.X - 250, ImGui.GetTextLineHeightWithSpacing() + (ImGui.GetStyle().FramePadding.Y * 2))); ImGui.SetNextItemWidth(240); ImGui.InputTextWithHint("###searchInput", "Search for settings...", ref this.searchInput, 100); diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs index 8714fd666..d38f9219d 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs @@ -234,7 +234,9 @@ Contribute at: https://github.com/goatcorp/Dalamud { var windowSize = ImGui.GetWindowSize(); - ImGui.BeginChild("scrolling", Vector2.Zero, false, ImGuiWindowFlags.NoScrollbar); + using var child = ImRaii.Child("scrolling", new Vector2(-1, -10 * ImGuiHelpers.GlobalScale), false, ImGuiWindowFlags.NoScrollbar); + if (!child) + return; if (this.resetNow) { @@ -295,8 +297,6 @@ Contribute at: https://github.com/goatcorp/Dalamud } } - ImGui.EndChild(); - base.Draw(); }