mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Log windowSystem focus changes
This commit is contained in:
parent
3e1a018799
commit
2c6834b4ba
1 changed files with 19 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
|
||||
using ImGuiNET;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Interface.Windowing
|
||||
{
|
||||
|
|
@ -15,6 +16,8 @@ namespace Dalamud.Interface.Windowing
|
|||
|
||||
private readonly List<Window> windows = new();
|
||||
|
||||
private string lastFocusedWindowName = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WindowSystem"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -94,13 +97,28 @@ namespace Dalamud.Interface.Windowing
|
|||
window.DrawInternal();
|
||||
}
|
||||
|
||||
this.HasAnyFocus = this.windows.Any(x => x.IsFocused && x.RespectCloseHotkey);
|
||||
var focusedWindow = this.windows.FirstOrDefault(x => x.IsFocused && x.RespectCloseHotkey);
|
||||
this.HasAnyFocus = focusedWindow != default;
|
||||
|
||||
if (this.HasAnyFocus)
|
||||
{
|
||||
if (this.lastFocusedWindowName != focusedWindow.WindowName)
|
||||
{
|
||||
Log.Verbose($"WindowSystem \"{this.Namespace}\" Window \"{focusedWindow.WindowName}\" has focus now");
|
||||
this.lastFocusedWindowName = focusedWindow.WindowName;
|
||||
}
|
||||
|
||||
HasAnyWindowSystemFocus = true;
|
||||
lastAnyFocus = DateTimeOffset.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.lastFocusedWindowName != string.Empty)
|
||||
{
|
||||
Log.Verbose($"WindowSystem \"{this.Namespace}\" Window \"{this.lastFocusedWindowName}\" lost focus");
|
||||
this.lastFocusedWindowName = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasNamespace)
|
||||
ImGui.PopID();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue