mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Compare commits
3 commits
b89d38968e
...
74f6145321
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74f6145321 | ||
|
|
02e0f1d36c | ||
|
|
4c3ba35f07 |
5 changed files with 26 additions and 4 deletions
|
|
@ -113,7 +113,7 @@ internal sealed unsafe class DalamudAtkTweaks : IInternalDisposableService
|
||||||
private void AtkUnitBaseReceiveGlobalEventDetour(AtkUnitBase* thisPtr, AtkEventType eventType, int eventParam, AtkEvent* atkEvent, AtkEventData* atkEventData)
|
private void AtkUnitBaseReceiveGlobalEventDetour(AtkUnitBase* thisPtr, AtkEventType eventType, int eventParam, AtkEvent* atkEvent, AtkEventData* atkEventData)
|
||||||
{
|
{
|
||||||
// 3 == Close
|
// 3 == Close
|
||||||
if (eventType == AtkEventType.InputReceived && WindowSystem.HasAnyWindowSystemFocus && atkEventData != null && *(int*)atkEventData == 3 && this.configuration.IsFocusManagementEnabled)
|
if (eventType == AtkEventType.InputReceived && WindowSystem.ShouldInhibitAtkCloseEvents && atkEventData != null && *(int*)atkEventData == 3 && this.configuration.IsFocusManagementEnabled)
|
||||||
{
|
{
|
||||||
Log.Verbose($"Cancelling global event SendHotkey command due to WindowSystem {WindowSystem.FocusedWindowSystemNamespace}");
|
Log.Verbose($"Cancelling global event SendHotkey command due to WindowSystem {WindowSystem.FocusedWindowSystemNamespace}");
|
||||||
return;
|
return;
|
||||||
|
|
@ -124,7 +124,7 @@ internal sealed unsafe class DalamudAtkTweaks : IInternalDisposableService
|
||||||
|
|
||||||
private void AgentHudOpenSystemMenuDetour(AgentHUD* thisPtr, AtkValue* atkValueArgs, uint menuSize)
|
private void AgentHudOpenSystemMenuDetour(AgentHUD* thisPtr, AtkValue* atkValueArgs, uint menuSize)
|
||||||
{
|
{
|
||||||
if (WindowSystem.HasAnyWindowSystemFocus && this.configuration.IsFocusManagementEnabled)
|
if (WindowSystem.ShouldInhibitAtkCloseEvents && this.configuration.IsFocusManagementEnabled)
|
||||||
{
|
{
|
||||||
Log.Verbose($"Cancelling OpenSystemMenu due to WindowSystem {WindowSystem.FocusedWindowSystemNamespace}");
|
Log.Verbose($"Cancelling OpenSystemMenu due to WindowSystem {WindowSystem.FocusedWindowSystemNamespace}");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1175,6 +1175,7 @@ internal partial class InterfaceManager : IInternalDisposableService
|
||||||
|
|
||||||
WindowSystem.HasAnyWindowSystemFocus = false;
|
WindowSystem.HasAnyWindowSystemFocus = false;
|
||||||
WindowSystem.FocusedWindowSystemNamespace = string.Empty;
|
WindowSystem.FocusedWindowSystemNamespace = string.Empty;
|
||||||
|
WindowSystem.ShouldInhibitAtkCloseEvents = false;
|
||||||
|
|
||||||
if (this.IsDispatchingEvents)
|
if (this.IsDispatchingEvents)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,16 @@ public abstract class Window
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AllowClickthrough { get; set; } = true;
|
public bool AllowClickthrough { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this window is pinned.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsPinned => this.internalIsPinned;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this window is click-through.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsClickthrough => this.internalIsClickthrough;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a list of available title bar buttons.
|
/// Gets or sets a list of available title bar buttons.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,12 @@ public class WindowSystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Namespace { get; set; }
|
public string? Namespace { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether ATK close events should be inhibited while any window has focus.
|
||||||
|
/// Does not respect windows that are pinned or clickthrough.
|
||||||
|
/// </summary>
|
||||||
|
internal static bool ShouldInhibitAtkCloseEvents { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a window to this <see cref="WindowSystem"/>.
|
/// Add a window to this <see cref="WindowSystem"/>.
|
||||||
/// The window system doesn't own your window, it just renders it
|
/// The window system doesn't own your window, it just renders it
|
||||||
|
|
@ -130,7 +136,7 @@ public class WindowSystem
|
||||||
window.DrawInternal(flags, persistence);
|
window.DrawInternal(flags, persistence);
|
||||||
}
|
}
|
||||||
|
|
||||||
var focusedWindow = this.windows.FirstOrDefault(window => window.IsFocused && window.RespectCloseHotkey);
|
var focusedWindow = this.windows.FirstOrDefault(window => window.IsFocused);
|
||||||
this.HasAnyFocus = focusedWindow != default;
|
this.HasAnyFocus = focusedWindow != default;
|
||||||
|
|
||||||
if (this.HasAnyFocus)
|
if (this.HasAnyFocus)
|
||||||
|
|
@ -155,6 +161,11 @@ public class WindowSystem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShouldInhibitAtkCloseEvents |= this.windows.Any(w => w.IsFocused &&
|
||||||
|
w.RespectCloseHotkey &&
|
||||||
|
!w.IsPinned &&
|
||||||
|
!w.IsClickthrough);
|
||||||
|
|
||||||
if (hasNamespace)
|
if (hasNamespace)
|
||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5d01489c34f33a3d645f49085d7fc0065a1ac801
|
Subproject commit f859652864541bc08108937c6d6ea0688da61c7c
|
||||||
Loading…
Add table
Add a link
Reference in a new issue