GPR: Fix editor window preventing ESC menu opening because of dalamud's terrible focus management

master
Liza 2024-08-12 18:14:47 +02:00
parent 28d50dfc81
commit 69436a73bb
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 14 additions and 3 deletions

View File

@ -35,6 +35,7 @@ public sealed class RendererPlugin : IDalamudPlugin
private readonly EditorWindow _editorWindow;
private readonly List<GatheringLocationContext> _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<object>("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)
{

View File

@ -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()