From 69436a73bb88819fa7021ea7e369a6fb632e26f1 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 12 Aug 2024 18:14:47 +0200 Subject: [PATCH] GPR: Fix editor window preventing ESC menu opening because of dalamud's terrible focus management --- GatheringPathRenderer/RendererPlugin.cs | 10 ++++++++-- GatheringPathRenderer/Windows/EditorWindow.cs | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/GatheringPathRenderer/RendererPlugin.cs b/GatheringPathRenderer/RendererPlugin.cs index e90e67b43..50f9e4a74 100644 --- a/GatheringPathRenderer/RendererPlugin.cs +++ b/GatheringPathRenderer/RendererPlugin.cs @@ -35,6 +35,7 @@ public sealed class RendererPlugin : IDalamudPlugin private readonly EditorWindow _editorWindow; private readonly List _gatheringLocations = []; + private EClassJob _currentClassJob; public RendererPlugin(IDalamudPluginInterface pluginInterface, IClientState clientState, ICommandManager commandManager, IDataManager dataManager, ITargetManager targetManager, IChatGui chatGui, @@ -56,6 +57,7 @@ public sealed class RendererPlugin : IDalamudPlugin _editorWindow = new EditorWindow(this, _editorCommands, dataManager, targetManager, clientState, objectTable) { IsOpen = true }; _windowSystem.AddWindow(_editorWindow); + _currentClassJob = (EClassJob?)_clientState.LocalPlayer?.ClassJob.Id ?? EClassJob.Adventurer; _pluginInterface.GetIpcSubscriber("Questionable.ReloadData") .Subscribe(Reload); @@ -176,9 +178,13 @@ public sealed class RendererPlugin : IDalamudPlugin private void TerritoryChanged(ushort territoryId) => Redraw(); - private void ClassJobChanged(uint classJobId) => Redraw((EClassJob)classJobId); + private void ClassJobChanged(uint classJobId) + { + _currentClassJob = (EClassJob)classJobId; + Redraw(_currentClassJob); + } - internal void Redraw() => Redraw((EClassJob)_clientState.LocalPlayer!.ClassJob.Id); + internal void Redraw() => Redraw(_currentClassJob); private void Redraw(EClassJob classJob) { diff --git a/GatheringPathRenderer/Windows/EditorWindow.cs b/GatheringPathRenderer/Windows/EditorWindow.cs index 7541001f3..e081c9671 100644 --- a/GatheringPathRenderer/Windows/EditorWindow.cs +++ b/GatheringPathRenderer/Windows/EditorWindow.cs @@ -34,7 +34,8 @@ internal sealed class EditorWindow : Window public EditorWindow(RendererPlugin plugin, EditorCommands editorCommands, IDataManager dataManager, ITargetManager targetManager, IClientState clientState, IObjectTable objectTable) - : base("Gathering Path Editor###QuestionableGatheringPathEditor") + : base("Gathering Path Editor###QuestionableGatheringPathEditor", + ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNavFocus) { _plugin = plugin; _editorCommands = editorCommands; @@ -47,7 +48,11 @@ internal sealed class EditorWindow : Window { MinimumSize = new Vector2(300, 300), }; + + RespectCloseHotkey = false; ShowCloseButton = false; + AllowPinning = false; + AllowClickthrough = false; } public override void Update()