feat: do not close addons when any Window is still open

This commit is contained in:
goat 2021-09-01 19:50:23 +02:00
parent 647d095fcc
commit 412a335b93
No known key found for this signature in database
GPG key ID: F18F057873895461
6 changed files with 68 additions and 28 deletions

View file

@ -49,7 +49,7 @@ namespace Dalamud.Interface.Windowing
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.
/// Gets or sets a value indicating whether this window is 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;
@ -112,6 +112,9 @@ namespace Dalamud.Interface.Windowing
set
{
this.internalIsOpen = value;
if (value == false)
this.IsFocused = false;
}
}

View file

@ -22,6 +22,12 @@ namespace Dalamud.Interface.Windowing
this.Namespace = imNamespace;
}
/// <summary>
/// Gets a value indicating whether any window in this <see cref="WindowSystem"/> has focus and is
/// not marked to be excluded from consideration.
/// </summary>
public bool HasAnyFocus { get; private set; }
/// <summary>
/// Gets or sets the name/ID-space of this <see cref="WindowSystem"/>.
/// </summary>
@ -75,6 +81,8 @@ namespace Dalamud.Interface.Windowing
window.DrawInternal();
}
this.HasAnyFocus = this.windows.Any(x => x.IsFocused && x.RespectCloseHotkey);
if (hasNamespace)
ImGui.PopID();
}