feat: add Window.RespectCloseHotkey

This commit is contained in:
goat 2021-09-01 16:02:58 +02:00
parent d5d18e1712
commit 647d095fcc
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -48,6 +48,11 @@ namespace Dalamud.Interface.Windowing
/// </summary>
public bool IsFocused { get; private set; }
/// <summary>
/// Allow this window to be closed with a hotkey, like Escape, and keep game addons open in turn if it is closed.
/// </summary>
public bool RespectCloseHotkey { get; set; } = true;
/// <summary>
/// Gets or sets the position of this window.
/// </summary>
@ -196,7 +201,7 @@ namespace Dalamud.Interface.Windowing
this.IsFocused = ImGui.IsWindowFocused();
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame)
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame && this.RespectCloseHotkey)
{
this.IsOpen = false;
wasEscPressedLastFrame = true;