feat(window): restore hide-chat-window + Enter-to-restore (1.5.6)

The eye/hide button now hides the HellionChat window (runtime-only, via a new
DrawConditions gate) instead of toggling native-chat suppression, matching 1.5.6.
The chat-activation keybind (Enter / "/"), whose dispatch was a dead stub in the
KeybindManager since the v1.6.0 rewrite, is re-wired to MainWindow.ActivateChat:
it un-hides, opens if closed, brings the window to front and focuses the input --
so the chat reacts to Enter again from any state. /hellion is a reliable one-press
recovery (Toggle now clears the hide), and the window always shows on login
(start state no longer read from the persisted flag). Adds HideRestoreSelfTestStep.
This commit is contained in:
2026-06-15 20:49:14 +02:00
parent b397591ba4
commit a73f4d0d0c
7 changed files with 124 additions and 19 deletions
+32 -4
View File
@@ -33,6 +33,10 @@ internal sealed class MainWindow : Window
private Tab? _activeTab;
// Runtime-only hide: window stays IsOpen but DrawConditions skips it, so the
// chat-activation key can restore it (1.5.6 HideState.User parity).
private bool _userHidden;
public Vector2 LastWindowPos { get; private set; } = Vector2.Zero;
public Vector2 LastWindowSize { get; private set; } = Vector2.Zero;
internal unsafe ImGuiViewport* LastViewport;
@@ -66,7 +70,9 @@ internal sealed class MainWindow : Window
MinimumSize = new Vector2(MinWidth, MinHeight),
MaximumSize = new Vector2(float.MaxValue, float.MaxValue),
};
IsOpen = Plugin.Config.MainWindowOpen;
// 1.5.6 parity: the chat always shows on login. The window stays closeable
// and hideable within a session, but that state is not carried across starts.
IsOpen = true;
RespectCloseHotkey = false;
}
@@ -162,11 +168,33 @@ internal sealed class MainWindow : Window
internal Components.MessageList GetMessageListForSelfTest() => _messages;
// new-shadow on Window.Toggle so the open path also writes Config —
// OnClose already covers the close path through the base behaviour.
public override bool DrawConditions() => !_userHidden;
internal void UserHide() => _userHidden = true;
// Chat-activation keybind (Enter) entry point. Field writes only, so it is safe
// from the framework thread; the draw path applies focus next frame.
internal void ActivateChat()
{
_userHidden = false;
if (!IsOpen)
{
IsOpen = true;
Plugin.Config.MainWindowOpen = true;
}
BringToFront();
_input.Activate = true;
}
// new-shadow on Window.Toggle so the open path also writes Config. A user-hide
// counts as "not visible", so /hellion is a reliable one-press recovery even when
// the Enter keybind can't fire (DirectChat / a focused game text field).
public new void Toggle()
{
IsOpen = !IsOpen;
var visible = IsOpen && !_userHidden;
IsOpen = !visible;
if (IsOpen)
_userHidden = false;
Plugin.Config.MainWindowOpen = IsOpen;
}