mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +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 System.Linq;
|
||||||
|
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Windowing
|
namespace Dalamud.Interface.Windowing
|
||||||
{
|
{
|
||||||
|
|
@ -15,6 +16,8 @@ namespace Dalamud.Interface.Windowing
|
||||||
|
|
||||||
private readonly List<Window> windows = new();
|
private readonly List<Window> windows = new();
|
||||||
|
|
||||||
|
private string lastFocusedWindowName = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="WindowSystem"/> class.
|
/// Initializes a new instance of the <see cref="WindowSystem"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -94,13 +97,28 @@ namespace Dalamud.Interface.Windowing
|
||||||
window.DrawInternal();
|
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.HasAnyFocus)
|
||||||
{
|
{
|
||||||
|
if (this.lastFocusedWindowName != focusedWindow.WindowName)
|
||||||
|
{
|
||||||
|
Log.Verbose($"WindowSystem \"{this.Namespace}\" Window \"{focusedWindow.WindowName}\" has focus now");
|
||||||
|
this.lastFocusedWindowName = focusedWindow.WindowName;
|
||||||
|
}
|
||||||
|
|
||||||
HasAnyWindowSystemFocus = true;
|
HasAnyWindowSystemFocus = true;
|
||||||
lastAnyFocus = DateTimeOffset.Now;
|
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)
|
if (hasNamespace)
|
||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue