diff --git a/Dalamud/Game/Internal/DalamudAtkTweaks.cs b/Dalamud/Game/Internal/DalamudAtkTweaks.cs index 404eeaf90..2e081e9a6 100644 --- a/Dalamud/Game/Internal/DalamudAtkTweaks.cs +++ b/Dalamud/Game/Internal/DalamudAtkTweaks.cs @@ -78,7 +78,10 @@ namespace Dalamud.Game.Internal // "Close Addon" if (cmd == 12 && WindowSystem.HasAnyWindowSystemFocus) + { + Log.Verbose($"Cancelling global event CloseAddon command due to WindowSystem {WindowSystem.FocusedWindowSystemNamespace}"); return IntPtr.Zero; + } return this.hookAtkUnitBaseReceiveGlobalEvent.Original(thisPtr, cmd, a3, a4, a5); } @@ -86,7 +89,10 @@ namespace Dalamud.Game.Internal private void AgentHudOpenSystemMenuDetour(void* thisPtr, AtkValue* atkValueArgs, uint menuSize) { if (WindowSystem.HasAnyWindowSystemFocus) + { + Log.Verbose($"Cancelling OpenSystemMenu due to WindowSystem {WindowSystem.FocusedWindowSystemNamespace}"); return; + } var configuration = Service.Get(); diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index ea730669e..fe0af1a9d 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -648,6 +648,7 @@ namespace Dalamud.Interface.Internal this.lastWantCapture = this.LastImGuiIoPtr.WantCaptureMouse; WindowSystem.HasAnyWindowSystemFocus = false; + WindowSystem.FocusedWindowSystemNamespace = string.Empty; this.Draw?.Invoke(); Service.Get().Draw(); diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index ccfefd241..4d3a03a0d 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -31,7 +31,12 @@ namespace Dalamud.Interface.Windowing /// Gets a value indicating whether any contains any /// that has focus and is not marked to be excluded from consideration. /// - public static bool HasAnyWindowSystemFocus { get; internal set; } + public static bool HasAnyWindowSystemFocus { get; internal set; } = false; + + /// + /// Gets the name of the currently focused window system that is redirecting normal escape functionality. + /// + public static string FocusedWindowSystemNamespace { get; internal set; } = string.Empty; /// /// Gets the timespan since the last time any window was focused. @@ -109,6 +114,8 @@ namespace Dalamud.Interface.Windowing } HasAnyWindowSystemFocus = true; + FocusedWindowSystemNamespace = this.Namespace; + lastAnyFocus = DateTimeOffset.Now; } else