mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
feat: consider all WindowSystems globally
This commit is contained in:
parent
f6a68bac6e
commit
3e9c1f8d53
3 changed files with 16 additions and 5 deletions
|
|
@ -6,6 +6,7 @@ using CheapLoc;
|
|||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -75,10 +76,8 @@ namespace Dalamud.Game.Internal
|
|||
|
||||
private IntPtr AtkUnitBaseReceiveGlobalEventDetour(AtkUnitBase* thisPtr, ushort cmd, uint a3, IntPtr a4, uint* a5)
|
||||
{
|
||||
var di = Service<DalamudInterface>.Get();
|
||||
|
||||
// "Close Addon"
|
||||
if (cmd == 12 && di.WindowSystem.HasAnyFocus)
|
||||
if (cmd == 12 && WindowSystem.HasAnyWindowSystemFocus)
|
||||
return IntPtr.Zero;
|
||||
|
||||
return this.hookAtkUnitBaseReceiveGlobalEvent.Original(thisPtr, cmd, a3, a4, a5);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ using Dalamud.Game.Internal.DXGI;
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Hooking.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
|
|
@ -639,6 +640,8 @@ namespace Dalamud.Interface.Internal
|
|||
this.LastImGuiIoPtr = ImGui.GetIO();
|
||||
this.lastWantCapture = this.LastImGuiIoPtr.WantCaptureMouse;
|
||||
|
||||
WindowSystem.HasAnyWindowSystemFocus = false;
|
||||
|
||||
this.Draw?.Invoke();
|
||||
Service<NotificationManager>.Get().Draw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,17 @@ namespace Dalamud.Interface.Windowing
|
|||
/// Initializes a new instance of the <see cref="WindowSystem"/> class.
|
||||
/// </summary>
|
||||
/// <param name="imNamespace">The name/ID-space of this <see cref="WindowSystem"/>.</param>
|
||||
public WindowSystem(string imNamespace = null)
|
||||
public WindowSystem(string? imNamespace = null)
|
||||
{
|
||||
this.Namespace = imNamespace;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether any <see cref="WindowSystem"/> contains any <see cref="Window"/>
|
||||
/// that has focus and is not marked to be excluded from consideration.
|
||||
/// </summary>
|
||||
public static bool HasAnyWindowSystemFocus { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether any window in this <see cref="WindowSystem"/> has focus and is
|
||||
/// not marked to be excluded from consideration.
|
||||
|
|
@ -31,7 +37,7 @@ namespace Dalamud.Interface.Windowing
|
|||
/// <summary>
|
||||
/// Gets or sets the name/ID-space of this <see cref="WindowSystem"/>.
|
||||
/// </summary>
|
||||
public string Namespace { get; set; }
|
||||
public string? Namespace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Add a window to this <see cref="WindowSystem"/>.
|
||||
|
|
@ -83,6 +89,9 @@ namespace Dalamud.Interface.Windowing
|
|||
|
||||
this.HasAnyFocus = this.windows.Any(x => x.IsFocused && x.RespectCloseHotkey);
|
||||
|
||||
if (this.HasAnyFocus)
|
||||
HasAnyWindowSystemFocus = true;
|
||||
|
||||
if (hasNamespace)
|
||||
ImGui.PopID();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue