mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Force style vars so erroring window renders at least partially sanely
This commit is contained in:
parent
02e0f1d36c
commit
2a60bc61a7
1 changed files with 42 additions and 5 deletions
|
|
@ -57,6 +57,7 @@ public abstract class Window
|
|||
|
||||
private bool hasError = false;
|
||||
private Exception? lastError;
|
||||
private bool isErrorStylePushed;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||
|
|
@ -425,8 +426,16 @@ public abstract class Window
|
|||
UIGlobals.PlaySoundEffect(this.OnOpenSfxId);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (!this.hasError)
|
||||
{
|
||||
flags |= ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize;
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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<IDalamudTextureWrap>(tex));
|
||||
}
|
||||
|
||||
if (!this.hasError)
|
||||
{
|
||||
this.PostDraw();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.isErrorStylePushed)
|
||||
{
|
||||
Style.StyleModelV1.DalamudStandard.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
this.PostHandlePreset(persistence);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue