From 2a60bc61a7713172bf60ff1b2b78076b44473ac4 Mon Sep 17 00:00:00 2001 From: MidoriKami Date: Thu, 27 Nov 2025 15:52:18 -0800 Subject: [PATCH 1/3] Force style vars so erroring window renders at least partially sanely --- Dalamud/Interface/Windowing/Window.cs | 47 ++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index f12e87099..5169b9746 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -57,6 +57,7 @@ public abstract class Window private bool hasError = false; private Exception? lastError; + private bool isErrorStylePushed; /// /// Initializes a new instance of the class. @@ -425,8 +426,16 @@ public abstract class Window UIGlobals.PlaySoundEffect(this.OnOpenSfxId); } - this.PreDraw(); - this.ApplyConditionals(); + if (!this.hasError) + { + this.PreDraw(); + this.ApplyConditionals(); + } + else + { + Style.StyleModelV1.DalamudStandard.Push(); + this.isErrorStylePushed = true; + } if (this.ForceMainWindow) ImGuiHelpers.ForceNextWindowMainViewport(); @@ -448,10 +457,28 @@ public abstract class Window var flags = this.Flags; if (this.internalIsPinned || this.internalIsClickthrough) - flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize; + { + if (!this.hasError) + { + flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize; + } + else + { + flags &= ~(ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); + } + } if (this.internalIsClickthrough) - flags |= ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs; + { + if (!this.hasError) + { + flags |= ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs; + } + else + { + flags &= ~(ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs); + } + } if (this.CanShowCloseButton ? ImGui.Begin(this.WindowName, ref this.internalIsOpen, flags) : ImGui.Begin(this.WindowName, flags)) { @@ -670,7 +697,17 @@ public abstract class Window Task.FromResult(tex)); } - this.PostDraw(); + if (!this.hasError) + { + this.PostDraw(); + } + else + { + if (this.isErrorStylePushed) + { + Style.StyleModelV1.DalamudStandard.Pop(); + } + } this.PostHandlePreset(persistence); From 2e246967317427d2d5749d69b24a3e8ebc77d328 Mon Sep 17 00:00:00 2001 From: MidoriKami Date: Sun, 30 Nov 2025 14:47:24 -0800 Subject: [PATCH 2/3] Set flags, and unlock size --- Dalamud/Interface/Windowing/Window.cs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 5169b9746..700481ce5 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -458,26 +458,20 @@ public abstract class Window if (this.internalIsPinned || this.internalIsClickthrough) { - if (!this.hasError) - { - flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize; - } - else - { - flags &= ~(ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize); - } + flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize; } if (this.internalIsClickthrough) { - if (!this.hasError) - { - flags |= ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs; - } - else - { - flags &= ~(ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs); - } + flags |= ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs; + } + + // If we have an error, reset all flags to default, and unlock window size. + if (this.hasError) + { + flags = ImGuiWindowFlags.None; + ImGui.SetNextWindowCollapsed(false, ImGuiCond.Once); + ImGui.SetNextWindowSizeConstraints(Vector2.Zero, Vector2.PositiveInfinity); } if (this.CanShowCloseButton ? ImGui.Begin(this.WindowName, ref this.internalIsOpen, flags) : ImGui.Begin(this.WindowName, flags)) From 14e97a1a374b7968f28dc856203e9ba990c31ccd Mon Sep 17 00:00:00 2001 From: MidoriKami Date: Mon, 1 Dec 2025 14:19:12 -0800 Subject: [PATCH 3/3] Use local variable to track pushed style state --- Dalamud/Interface/Windowing/Window.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 700481ce5..e90e38119 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -57,7 +57,6 @@ public abstract class Window private bool hasError = false; private Exception? lastError; - private bool isErrorStylePushed; /// /// Initializes a new instance of the class. @@ -426,6 +425,7 @@ public abstract class Window UIGlobals.PlaySoundEffect(this.OnOpenSfxId); } + var isErrorStylePushed = false; if (!this.hasError) { this.PreDraw(); @@ -434,7 +434,7 @@ public abstract class Window else { Style.StyleModelV1.DalamudStandard.Push(); - this.isErrorStylePushed = true; + isErrorStylePushed = true; } if (this.ForceMainWindow) @@ -697,7 +697,7 @@ public abstract class Window } else { - if (this.isErrorStylePushed) + if (isErrorStylePushed) { Style.StyleModelV1.DalamudStandard.Pop(); }