From 94fdef38ad9b52c68f6efc191261ec9720f9c825 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Wed, 27 May 2026 08:08:29 +0200 Subject: [PATCH] feat(main-window): track per-frame window pos/size/viewport for PayloadHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the v1.5.6 `LogWindow.LastViewport/LastWindowPos/LastWindowSize` window-instance state with public/internal MainWindow surfaces refreshed at the top of Draw() each frame. PayloadHandler.MoveTooltip in Phase 2 will read these to filter cross-viewport AddonLifecycle events and to reposition the native item tooltip away from the chat window. LastViewport is `internal unsafe` (not public) — the only consumer is PayloadHandler.MoveTooltip in the same assembly; keeping the raw pointer out of the public surface is the safer default. Split from Sub-Task A — Lender injection lives in A2 (after F's DI-reg). --- HellionChat/Ui/Windows/MainWindow.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/HellionChat/Ui/Windows/MainWindow.cs b/HellionChat/Ui/Windows/MainWindow.cs index e38c87f..c1293ca 100644 --- a/HellionChat/Ui/Windows/MainWindow.cs +++ b/HellionChat/Ui/Windows/MainWindow.cs @@ -29,6 +29,10 @@ internal sealed class MainWindow : Window private Tab? _activeTab; + public Vector2 LastWindowPos { get; private set; } = Vector2.Zero; + public Vector2 LastWindowSize { get; private set; } = Vector2.Zero; + internal unsafe ImGuiViewport* LastViewport; + public MainWindow( Components.HonorificHeader honorific, Components.Sidebar sidebar, @@ -81,6 +85,13 @@ internal sealed class MainWindow : Window public override void Draw() { + LastWindowPos = ImGui.GetWindowPos(); + LastWindowSize = ImGui.GetWindowSize(); + unsafe + { + LastViewport = ImGui.GetWindowViewport().Handle; + } + // First-frame seed: the active tab defaults to the first persisted // tab so the message list isn't empty on a clean session. if (_activeTab is null && Plugin.Config.Tabs.Count > 0)