Merge pull request #2476 from MidoriKami/ForceErrorStyle
Some checks failed
Build Dalamud / Build on Windows (push) Waiting to run
Build Dalamud / Check API Compatibility (push) Blocked by required conditions
Build Dalamud / Deploy dalamud-distrib staging (push) Blocked by required conditions
Rollup changes to next version / check (api14) (push) Failing after 6s
Tag Build / Tag Build (push) Successful in 2s

Erroring Window Style Fix
This commit is contained in:
goat 2025-12-02 23:20:54 +01:00 committed by GitHub
commit 85949072ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -425,8 +425,17 @@ public abstract class Window
UIGlobals.PlaySoundEffect(this.OnOpenSfxId); UIGlobals.PlaySoundEffect(this.OnOpenSfxId);
} }
var isErrorStylePushed = false;
if (!this.hasError)
{
this.PreDraw(); this.PreDraw();
this.ApplyConditionals(); this.ApplyConditionals();
}
else
{
Style.StyleModelV1.DalamudStandard.Push();
isErrorStylePushed = true;
}
if (this.ForceMainWindow) if (this.ForceMainWindow)
ImGuiHelpers.ForceNextWindowMainViewport(); ImGuiHelpers.ForceNextWindowMainViewport();
@ -448,10 +457,22 @@ public abstract class Window
var flags = this.Flags; var flags = this.Flags;
if (this.internalIsPinned || this.internalIsClickthrough) if (this.internalIsPinned || this.internalIsClickthrough)
{
flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize; flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize;
}
if (this.internalIsClickthrough) if (this.internalIsClickthrough)
{
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)) if (this.CanShowCloseButton ? ImGui.Begin(this.WindowName, ref this.internalIsOpen, flags) : ImGui.Begin(this.WindowName, flags))
{ {
@ -670,7 +691,17 @@ public abstract class Window
Task.FromResult<IDalamudTextureWrap>(tex)); Task.FromResult<IDalamudTextureWrap>(tex));
} }
if (!this.hasError)
{
this.PostDraw(); this.PostDraw();
}
else
{
if (isErrorStylePushed)
{
Style.StyleModelV1.DalamudStandard.Pop();
}
}
this.PostHandlePreset(persistence); this.PostHandlePreset(persistence);