From fa4c57c8861b29b5b9d0e5c2aef27f71434c2a09 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Fri, 25 Feb 2022 14:30:53 +0100 Subject: [PATCH 1/2] Add two customization points for the window system that are executed always and that can control whether the window is drawn without toggling state. --- Dalamud/Interface/Windowing/Window.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index ff0a7b958..e1333e072 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -121,6 +121,28 @@ namespace Dalamud.Interface.Windowing this.IsOpen ^= true; } + /// + /// Code to always be executed before the open-state of the window is checked. + /// + public virtual void PreOpenCheck() + { + } + + /// + /// Additional conditions for the window to be drawn, regardless of its open-state. + /// + /// + /// True if the window should be drawn, false otherwise. + /// + /// + /// Not being drawn due to failing this condition will not change focus or trigger OnClose. + /// This is checked before PreDraw, but after Update. + /// + public virtual bool DrawConditions() + { + return true; + } + /// /// Code to be executed before conditionals are applied and the window is drawn. /// @@ -170,6 +192,8 @@ namespace Dalamud.Interface.Windowing /// internal void DrawInternal() { + this.PreOpenCheck(); + if (!this.IsOpen) { if (this.internalIsOpen != this.internalLastIsOpen) @@ -184,6 +208,8 @@ namespace Dalamud.Interface.Windowing } this.Update(); + if (!this.DrawConditions()) + return; var hasNamespace = !string.IsNullOrEmpty(this.Namespace); From 1b4e3a913c5d2e06e386d1c45aa957caa38cdc79 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Fri, 25 Feb 2022 14:31:12 +0100 Subject: [PATCH 2/2] fix: random comment typos --- Dalamud/ClientLanguageExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dalamud/ClientLanguageExtensions.cs b/Dalamud/ClientLanguageExtensions.cs index dccefb93f..abfba3ad5 100644 --- a/Dalamud/ClientLanguageExtensions.cs +++ b/Dalamud/ClientLanguageExtensions.cs @@ -10,8 +10,8 @@ namespace Dalamud /// /// Converts a Dalamud ClientLanguage to the corresponding Lumina variant. /// - /// Langauge to convert. - /// Converted langauge. + /// Language to convert. + /// Converted language. public static Lumina.Data.Language ToLumina(this ClientLanguage language) { return language switch