From 23c0e347374873b4b926569e7e1bbd1703472321 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 17 Oct 2021 19:46:48 -0400 Subject: [PATCH 1/5] Cleanup CorePlugin window. --- Dalamud.CorePlugin/PluginWindow.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Dalamud.CorePlugin/PluginWindow.cs b/Dalamud.CorePlugin/PluginWindow.cs index c54c032c6..6a45941f2 100644 --- a/Dalamud.CorePlugin/PluginWindow.cs +++ b/Dalamud.CorePlugin/PluginWindow.cs @@ -13,9 +13,6 @@ namespace Dalamud.CorePlugin /// internal class PluginWindow : Window, IDisposable { - private Vector4 bgCol = ImGuiColors.HealerGreen; - private Vector4 textCol = ImGuiColors.DalamudWhite; - /// /// Initializes a new instance of the class. /// @@ -41,21 +38,6 @@ namespace Dalamud.CorePlugin /// public override void Draw() { - ImGui.ColorPicker4("bg", ref this.bgCol); - ImGui.ColorPicker4("text", ref this.textCol); - - ImGui.PushStyleColor(ImGuiCol.ChildBg, this.bgCol); - ImGui.PushStyleColor(ImGuiCol.Text, this.textCol); - - if (ImGui.BeginChild("##changelog", new Vector2(-1, 100), true, ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoNavInputs | ImGuiWindowFlags.AlwaysAutoResize)) - { - ImGui.Text("Changelog:"); - ImGuiHelpers.ScaledDummy(2); - ImGui.TextWrapped("* ASIhif ai fdh adhsfuoadf\n* IUHoiaudsfh adsof hioaudshfuio husiodfh\n* A iiaojfdpasd ijopadfnklafwjenalkfjensgdlkjnasasdfbhnj"); - } - - ImGui.EndChild(); - ImGui.PopStyleColor(2); } } } From b763dd53687e677a92d9dc5d3625564df243ce23 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 17 Oct 2021 19:47:17 -0400 Subject: [PATCH 2/5] StyleModel should be internal, or outside the internal namespace. --- Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs index 7fa7a5b4f..0f5effe11 100644 --- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs +++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Numerics; @@ -12,7 +12,7 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor /// /// Class representing a serializable ImGui style. /// - public class StyleModel + internal class StyleModel { /// /// Initializes a new instance of the class. From 22810a10930b452e2f05ec4a231fffdd91f7d00f Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 17 Oct 2021 19:05:44 -0400 Subject: [PATCH 3/5] fix window focus for minimized windows --- Dalamud/Interface/Windowing/Window.cs | 24 ++++++++++----------- Dalamud/Interface/Windowing/WindowSystem.cs | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index dc8e47b6d..1ad7afdbd 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -197,20 +197,20 @@ namespace Dalamud.Interface.Windowing { // Draw the actual window contents this.Draw(); + } - this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows); + this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows); - var escapeDown = Service.Get()[VirtualKey.ESCAPE]; - var isAllowed = Service.Get().IsFocusManagementEnabled; - if (escapeDown && this.IsFocused && isAllowed && !wasEscPressedLastFrame && this.RespectCloseHotkey) - { - this.IsOpen = false; - wasEscPressedLastFrame = true; - } - else if (!escapeDown && wasEscPressedLastFrame) - { - wasEscPressedLastFrame = false; - } + var escapeDown = Service.Get()[VirtualKey.ESCAPE]; + var isAllowed = Service.Get().IsFocusManagementEnabled; + if (escapeDown && this.IsFocused && isAllowed && !wasEscPressedLastFrame && this.RespectCloseHotkey) + { + this.IsOpen = false; + wasEscPressedLastFrame = true; + } + else if (!escapeDown && wasEscPressedLastFrame) + { + wasEscPressedLastFrame = false; } ImGui.End(); diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 5f6334e8e..16dfcdf5c 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -107,7 +107,7 @@ namespace Dalamud.Interface.Windowing ImGuiManagedAsserts.ReportProblems(source, snapshot); } - var focusedWindow = this.windows.FirstOrDefault(x => x.IsFocused && x.RespectCloseHotkey); + var focusedWindow = this.windows.FirstOrDefault(window => window.IsFocused && window.RespectCloseHotkey); this.HasAnyFocus = focusedWindow != default; if (this.HasAnyFocus) From 339009a2fcaf9a649c4fef70bc49674934cf62b0 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 17 Oct 2021 19:47:55 -0400 Subject: [PATCH 4/5] Apply TitleBgActive coloring when minimized and focused Window-System applicable only --- Dalamud/Interface/Windowing/Window.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 1ad7afdbd..f173f8256 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -193,12 +193,25 @@ namespace Dalamud.Interface.Windowing this.OnOpen(); } + var wasFocused = this.IsFocused; + if (wasFocused) + { + var style = ImGui.GetStyle(); + var focusedHeaderColor = style.Colors[(int)ImGuiCol.TitleBgActive]; + ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, focusedHeaderColor); + } + if (ImGui.Begin(this.WindowName, ref this.internalIsOpen, this.Flags)) { // Draw the actual window contents this.Draw(); } + if (wasFocused) + { + ImGui.PopStyleColor(); + } + this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows); var escapeDown = Service.Get()[VirtualKey.ESCAPE]; From 31ebf06d53fb3a2a10bf6329329a1570f705ae8d Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 17 Oct 2021 19:49:55 -0400 Subject: [PATCH 5/5] fix: TaskTracker needs to run after framework or it explodes --- Dalamud/Dalamud.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index fdcaa2d44..0fa16b0d9 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -104,11 +104,6 @@ namespace Dalamud Service.Set(); -#if DEBUG - Service.Set(); - Log.Information("[T1] TaskTracker OK!"); -#endif - // Initialize the process information. Service.Set(new SigScanner(true)); Service.Set(); @@ -121,6 +116,10 @@ namespace Dalamud var framework = Service.Set(); Log.Information("[T1] Framework OK!"); +#if DEBUG + Service.Set(); + Log.Information("[T1] TaskTracker OK!"); +#endif Service.Set(); Service.Set();