mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
feat: add Window.RespectCloseHotkey
This commit is contained in:
parent
d5d18e1712
commit
647d095fcc
1 changed files with 6 additions and 1 deletions
|
|
@ -48,6 +48,11 @@ namespace Dalamud.Interface.Windowing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsFocused { get; private set; }
|
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>
|
/// <summary>
|
||||||
/// Gets or sets the position of this window.
|
/// Gets or sets the position of this window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -196,7 +201,7 @@ namespace Dalamud.Interface.Windowing
|
||||||
this.IsFocused = ImGui.IsWindowFocused();
|
this.IsFocused = ImGui.IsWindowFocused();
|
||||||
|
|
||||||
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
|
||||||
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame)
|
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame && this.RespectCloseHotkey)
|
||||||
{
|
{
|
||||||
this.IsOpen = false;
|
this.IsOpen = false;
|
||||||
wasEscPressedLastFrame = true;
|
wasEscPressedLastFrame = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue