mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-23 08:59: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.Configuration.Internal;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Interface.Internal;
|
using Dalamud.Interface.Internal;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
|
|
@ -75,10 +76,8 @@ namespace Dalamud.Game.Internal
|
||||||
|
|
||||||
private IntPtr AtkUnitBaseReceiveGlobalEventDetour(AtkUnitBase* thisPtr, ushort cmd, uint a3, IntPtr a4, uint* a5)
|
private IntPtr AtkUnitBaseReceiveGlobalEventDetour(AtkUnitBase* thisPtr, ushort cmd, uint a3, IntPtr a4, uint* a5)
|
||||||
{
|
{
|
||||||
var di = Service<DalamudInterface>.Get();
|
|
||||||
|
|
||||||
// "Close Addon"
|
// "Close Addon"
|
||||||
if (cmd == 12 && di.WindowSystem.HasAnyFocus)
|
if (cmd == 12 && WindowSystem.HasAnyWindowSystemFocus)
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
|
|
||||||
return this.hookAtkUnitBaseReceiveGlobalEvent.Original(thisPtr, cmd, a3, a4, a5);
|
return this.hookAtkUnitBaseReceiveGlobalEvent.Original(thisPtr, cmd, a3, a4, a5);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ using Dalamud.Game.Internal.DXGI;
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.Hooking.Internal;
|
using Dalamud.Hooking.Internal;
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using ImGuiScene;
|
using ImGuiScene;
|
||||||
|
|
@ -639,6 +640,8 @@ namespace Dalamud.Interface.Internal
|
||||||
this.LastImGuiIoPtr = ImGui.GetIO();
|
this.LastImGuiIoPtr = ImGui.GetIO();
|
||||||
this.lastWantCapture = this.LastImGuiIoPtr.WantCaptureMouse;
|
this.lastWantCapture = this.LastImGuiIoPtr.WantCaptureMouse;
|
||||||
|
|
||||||
|
WindowSystem.HasAnyWindowSystemFocus = false;
|
||||||
|
|
||||||
this.Draw?.Invoke();
|
this.Draw?.Invoke();
|
||||||
Service<NotificationManager>.Get().Draw();
|
Service<NotificationManager>.Get().Draw();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,17 @@ namespace Dalamud.Interface.Windowing
|
||||||
/// Initializes a new instance of the <see cref="WindowSystem"/> class.
|
/// Initializes a new instance of the <see cref="WindowSystem"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="imNamespace">The name/ID-space of this <see cref="WindowSystem"/>.</param>
|
/// <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;
|
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>
|
/// <summary>
|
||||||
/// Gets a value indicating whether any window in this <see cref="WindowSystem"/> has focus and is
|
/// Gets a value indicating whether any window in this <see cref="WindowSystem"/> has focus and is
|
||||||
/// not marked to be excluded from consideration.
|
/// not marked to be excluded from consideration.
|
||||||
|
|
@ -31,7 +37,7 @@ namespace Dalamud.Interface.Windowing
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name/ID-space of this <see cref="WindowSystem"/>.
|
/// Gets or sets the name/ID-space of this <see cref="WindowSystem"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Namespace { get; set; }
|
public string? Namespace { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a window to this <see cref="WindowSystem"/>.
|
/// 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);
|
this.HasAnyFocus = this.windows.Any(x => x.IsFocused && x.RespectCloseHotkey);
|
||||||
|
|
||||||
|
if (this.HasAnyFocus)
|
||||||
|
HasAnyWindowSystemFocus = true;
|
||||||
|
|
||||||
if (hasNamespace)
|
if (hasNamespace)
|
||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue