diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs
index 81f4373de..31a3d075c 100644
--- a/Dalamud/Interface/Windowing/Window.cs
+++ b/Dalamud/Interface/Windowing/Window.cs
@@ -9,7 +9,8 @@ namespace Dalamud.Interface.Windowing
///
public abstract class Window
{
- private bool internalIsOpen;
+ private bool internalLastIsOpen = false;
+ private bool internalIsOpen = false;
///
/// Initializes a new instance of the class.
@@ -99,6 +100,16 @@ namespace Dalamud.Interface.Windowing
///
public abstract void Draw();
+ ///
+ /// Code to be executed when the window is opened.
+ ///
+ public virtual void OnOpen() { }
+
+ ///
+ /// Code to be executed when the window is closed.
+ ///
+ public virtual void OnClose() { }
+
///
/// Draw the window via ImGui.
///
@@ -116,6 +127,20 @@ namespace Dalamud.Interface.Windowing
ImGui.End();
}
+
+ if (this.internalLastIsOpen != this.internalIsOpen)
+ {
+ if (this.internalIsOpen)
+ {
+ this.OnOpen();
+ }
+ else
+ {
+ this.OnClose();
+ }
+ }
+
+ this.internalLastIsOpen = this.internalIsOpen;
}
private void ApplyConditionals()
@@ -127,7 +152,7 @@ namespace Dalamud.Interface.Windowing
if (this.Size.HasValue)
{
- ImGui.SetNextWindowPos(this.Size.Value, this.SizeCondition);
+ ImGui.SetNextWindowPos(this.Size.Value * ImGuiHelpers.GlobalScale, this.SizeCondition);
}
if (this.Collapsed.HasValue)
@@ -137,7 +162,7 @@ namespace Dalamud.Interface.Windowing
if (this.SizeConstraintsMin.HasValue && this.SizeConstraintsMax.HasValue)
{
- ImGui.SetNextWindowSizeConstraints(this.SizeConstraintsMin.Value, this.SizeConstraintsMax.Value);
+ ImGui.SetNextWindowSizeConstraints(this.SizeConstraintsMin.Value * ImGuiHelpers.GlobalScale, this.SizeConstraintsMax.Value * ImGuiHelpers.GlobalScale);
}
}
}