feat(main-window): track per-frame window pos/size/viewport for PayloadHandler

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).
This commit is contained in:
2026-05-27 08:08:29 +02:00
parent 01fc69efda
commit 94fdef38ad
+11
View File
@@ -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)