diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs index 010178b26..d11e1ce1c 100644 --- a/Dalamud/Interface/Utility/ImGuiHelpers.cs +++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs @@ -25,6 +25,13 @@ public static class ImGuiHelpers /// public static float GlobalScale { get; private set; } + /// + /// Check if the current ImGui window is on the main viewport. + /// Only valid within a window. + /// + /// Whether the window is on the main viewport. + public static bool CheckIsWindowOnMainViewport() => MainViewport.ID == ImGui.GetWindowViewport().ID; + /// /// Gets a that is pre-scaled with the multiplier. /// diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 9e06a1d75..144eb35fc 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -362,6 +362,11 @@ public abstract class Window if (ImGui.BeginPopup(additionsPopupName, ImGuiWindowFlags.NoMove)) { + var isAvailable = ImGuiHelpers.CheckIsWindowOnMainViewport(); + + if (!isAvailable) + ImGui.BeginDisabled(); + if (this.internalIsClickthrough) ImGui.BeginDisabled(); @@ -391,13 +396,25 @@ public abstract class Window this.internalAlpha = null; } - ImGui.TextColored(ImGuiColors.DalamudGrey, - Loc.Localize("WindowSystemContextActionClickthroughDisclaimer", - "Open this menu again to disable clickthrough.")); - ImGui.TextColored(ImGuiColors.DalamudGrey, - Loc.Localize("WindowSystemContextActionDisclaimer", - "These options may not work for all plugins at the moment.")); + if (isAvailable) + { + ImGui.TextColored(ImGuiColors.DalamudGrey, + Loc.Localize("WindowSystemContextActionClickthroughDisclaimer", + "Open this menu again to disable clickthrough.")); + ImGui.TextColored(ImGuiColors.DalamudGrey, + Loc.Localize("WindowSystemContextActionDisclaimer", + "These options may not work for all plugins at the moment.")); + } + else + { + ImGui.TextColored(ImGuiColors.DalamudGrey, + Loc.Localize("WindowSystemContextActionViewportDisclaimer", + "These features are only available if this window is inside the game window.")); + } + if (!isAvailable) + ImGui.EndDisabled(); + ImGui.EndPopup(); }