Skip to content

Commit

Permalink
Pinning window disables close on escape key down (#2178)
Browse files Browse the repository at this point in the history
* Pinning window disables close on escape key down

* Update tooltip for window pinning
  • Loading branch information
Blooym authored Feb 6, 2025
1 parent af1ddf5 commit 5dd097d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Dalamud/Interface/Windowing/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Runtime.InteropServices;

using CheapLoc;

using Dalamud.Game.ClientState.Keys;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
Expand All @@ -15,7 +16,9 @@
using Dalamud.Logging.Internal;

using FFXIVClientStructs.FFXIV.Client.UI;

using ImGuiNET;

using PInvoke;

namespace Dalamud.Interface.Windowing;
Expand Down Expand Up @@ -429,7 +432,7 @@ internal void DrawInternal(WindowDrawFlags internalDrawFlags, WindowSystemPersis
}

ImGuiComponents.HelpMarker(
Loc.Localize("WindowSystemContextActionPinHint", "Pinned windows will not move or resize when you click and drag them."));
Loc.Localize("WindowSystemContextActionPinHint", "Pinned windows will not move or resize when you click and drag them, nor will they close when escape is pressed."));
}

if (this.internalIsClickthrough)
Expand Down Expand Up @@ -521,7 +524,7 @@ internal void DrawInternal(WindowDrawFlags internalDrawFlags, WindowSystemPersis

this.IsFocused = ImGui.IsWindowFocused(ImGuiFocusedFlags.RootAndChildWindows);

if (internalDrawFlags.HasFlag(WindowDrawFlags.UseFocusManagement))
if (internalDrawFlags.HasFlag(WindowDrawFlags.UseFocusManagement) && !this.internalIsPinned)
{
var escapeDown = Service<KeyState>.Get()[VirtualKey.ESCAPE];
if (escapeDown && this.IsFocused && !wasEscPressedLastFrame && this.RespectCloseHotkey)
Expand Down Expand Up @@ -701,7 +704,7 @@ bool DrawButton(TitleBarButton button, Vector2 pos)
drawList.AddCircleFilled(GetCenter(bb) + new Vector2(0.0f, -0.5f), (fontSize * 0.5f) + 1.0f, bgCol);

var offset = button.IconOffset * ImGuiHelpers.GlobalScale;
drawList.AddText(InterfaceManager.IconFont, (float)(fontSize * 0.8), new Vector2(bb.X + offset.X, bb.Y + offset.Y), textCol, button.Icon.ToIconString());
drawList.AddText(InterfaceManager.IconFont, (float)(fontSize * 0.8), new Vector2(bb.X + offset.X, bb.Y + offset.Y), textCol, button.Icon.ToIconString());

if (hovered)
button.ShowTooltip?.Invoke();
Expand Down

0 comments on commit 5dd097d

Please sign in to comment.