From 647d095fccfa537d5e710b0fc84780f1432beaa7 Mon Sep 17 00:00:00 2001
From: goat <16760685+goaaats@users.noreply.github.com>
Date: Wed, 1 Sep 2021 16:02:58 +0200
Subject: [PATCH] feat: add Window.RespectCloseHotkey
---
Dalamud/Interface/Windowing/Window.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs
index ec9115d8d..b506ffcb1 100644
--- a/Dalamud/Interface/Windowing/Window.cs
+++ b/Dalamud/Interface/Windowing/Window.cs
@@ -48,6 +48,11 @@ namespace Dalamud.Interface.Windowing
///
public bool IsFocused { get; private set; }
+ ///
+ /// Allow this window to be closed with a hotkey, like Escape, and keep game addons open in turn if it is closed.
+ ///
+ public bool RespectCloseHotkey { get; set; } = true;
+
///
/// Gets or sets the position of this window.
///
@@ -196,7 +201,7 @@ namespace Dalamud.Interface.Windowing
this.IsFocused = ImGui.IsWindowFocused();
var escapeDown = Service.Get()[VirtualKey.ESCAPE];
- if (escapeDown && this.IsFocused && !wasEscPressedLastFrame)
+ if (escapeDown && this.IsFocused && !wasEscPressedLastFrame && this.RespectCloseHotkey)
{
this.IsOpen = false;
wasEscPressedLastFrame = true;