Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions EllesmereUIBlizzardSkin/EllesmereUIBlizzardSkin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,25 @@ local function TooltipOwnerUsable(parent)
return true
end

-- Addons that cannot risk touching the global GameTooltip -- taint-sensitive
-- callers driving secure frames, such as OPie's ring view -- build their own
-- GameTooltipTemplate frame and flag it LIKE_GLOBAL_GAMETOOLTIP, which is their
-- documented request to be treated exactly as _G.GameTooltip. Those stand-ins
-- still route through GameTooltip_SetDefaultAnchor like everyone else, so a
-- strict identity check was the only thing keeping our anchors off them: their
-- tooltips ignored the fixed/cursor position and landed on Blizzard's default
-- container instead. Honour the flag for the anchor decision.
--
-- Strict identity is still correct everywhere else in this file. The armed-state
-- bookkeeping below hooks GameTooltip's OWN SetOwner/SetPoint methods, so it can
-- only ever track one tooltip; a stand-in gets the one-shot anchor at default
-- time and nothing re-anchors it afterwards, which is all it needs (Blizzard's
-- container logic, the reason that enforcement exists, does not manage it).
local function TooltipIsGlobalLike(tooltip)
if tooltip == GameTooltip then return true end
return type(tooltip) == "table" and tooltip.LIKE_GLOBAL_GAMETOOLTIP == true
end

do
-- Selected position = where the tooltip sits relative to the cursor, so the
-- tooltip corner that touches the cursor is the opposite one.
Expand Down Expand Up @@ -2220,7 +2239,7 @@ do
end

local function ApplyCursorAnchor(tooltip, parent)
if tooltip ~= GameTooltip then return end
if not TooltipIsGlobalLike(tooltip) then return end
-- Gated by the "Reskin Tooltip" master (matches the grayed-out option), so
-- disabling the reskin restores the default tooltip position.
if EllesmereUIDB and EllesmereUIDB.customTooltips == false then return end
Expand Down Expand Up @@ -2453,7 +2472,7 @@ do
end

local function ApplyFixedAnchor(tooltip, parent)
if tooltip ~= GameTooltip then return end
if not TooltipIsGlobalLike(tooltip) then return end
if not WantFixed() then return end
if tooltip:IsForbidden() then return end
-- A forbidden owner (a nameplate aura button) cannot be anchored to, so
Expand All @@ -2479,8 +2498,10 @@ do
end

hooksecurefunc("GameTooltip_SetDefaultAnchor", function(tooltip, parent)
if tooltip ~= GameTooltip then return end
_fixedArmed = true
if not TooltipIsGlobalLike(tooltip) then return end
-- Only the global tooltip can be armed: the SetPoint enforcement below
-- is hooked onto GameTooltip's own setters. See TooltipIsGlobalLike.
if tooltip == GameTooltip then _fixedArmed = true end
ApplyFixedAnchor(tooltip, parent)
end)
-- Every explicit tooltip build starts with SetOwner (it runs BEFORE the
Expand Down Expand Up @@ -2638,8 +2659,10 @@ do
end

hooksecurefunc("GameTooltip_SetDefaultAnchor", function(tooltip)
if tooltip ~= GameTooltip then return end
_growthDefaultAnchored = true
if not TooltipIsGlobalLike(tooltip) then return end
-- Only the global tooltip can be armed: the SetPoint enforcement below
-- is hooked onto GameTooltip's own setters. See TooltipIsGlobalLike.
if tooltip == GameTooltip then _growthDefaultAnchored = true end
Enforce(tooltip)
end)
-- Every tooltip build starts with SetOwner (it runs BEFORE the
Expand Down