fix(blizzskin): anchor stand-in tooltips like the global GameTooltip - #1253
Open
paulbuechner wants to merge 1 commit into
Open
fix(blizzskin): anchor stand-in tooltips like the global GameTooltip#1253paulbuechner wants to merge 1 commit into
paulbuechner wants to merge 1 commit into
Conversation
The three tooltip anchor features (cursor anchor, fixed position, growth
direction) all open their GameTooltip_SetDefaultAnchor post-hook with
if tooltip ~= GameTooltip then return end
That refuses tooltips which are not literally _G.GameTooltip, and some addons
cannot use the global one. A caller driving secure frames from insecure code
taints the global tooltip by touching it, so it builds its own
GameTooltipTemplate frame instead and flags it LIKE_GLOBAL_GAMETOOLTIP, which
is the established way of asking to be treated as the real thing. OPie does
exactly this for its ring slices (Libs/NotGameTooltip.lua):
tip.LIKE_GLOBAL_GAMETOOLTIP = true
-- External addons: please treat this as you would treat _G.GameTooltip
Those stand-ins are not going off on their own. They still anchor through
GameTooltip_SetDefaultAnchor, so our hook does fire for them; it just declines
on the first line. The tooltip therefore keeps whatever Blizzard's default
anchoring gave it and sits at the bottom-right container while every other
tooltip in the game obeys the user's anchor box.
TooltipIsGlobalLike accepts the global tooltip or any frame carrying the flag,
and is used for the anchor decision in those three places.
The armed-state bookkeeping deliberately stays on the global tooltip only.
_fixedArmed and _growthDefaultAnchored gate SetPoint enforcement that is hooked
onto GameTooltip's own setters, so they can only ever describe one tooltip;
arming them for a stand-in would let a later GameTooltip:SetPoint be enforced
against state belonging to a different frame. A stand-in gets the one-shot
anchor at default-anchor time, which is all it needs, since that enforcement
exists for Blizzard's container re-anchoring and Blizzard does not manage
third-party frames.
Left on strict identity: _repointTooltipAtCursor (only ever called by our own
frames with the global tooltip), the FadeOut and SetPoint/SetOwner hooks (bound
to the GameTooltip object itself), and the Show Tooltips suppression block,
which reparents into a hidden host and is a visibility feature rather than an
anchor one.
No cost when no stand-in exists: one extra table read on a path that already
ran, and nothing new is hooked, registered or created.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DISCLAIMER: AI was used to create this PR (Claude Fable 5 Max)
If "overwriting" other AddOns Tooltips relying on Blizzard's HUD-Tooltip isn't planned, you can close this PR right away.
What does this PR do?
Makes the tooltip anchor settings apply to addon tooltips that stand in for
GameTooltip. Today those tooltips ignore the anchor box and sit at Blizzard'sdefault bottom-right container while everything else in the game obeys the user's
setting. OPie's ring slice tooltips are the case I hit; the fix is generic.
All three anchor features (cursor anchor, fixed position, growth direction) open
their
GameTooltip_SetDefaultAnchorpost-hook with:That refuses anything which is not literally
_G.GameTooltip, and some addonscannot use the global one. A caller driving secure frames from insecure code
taints the global tooltip by touching it, so it builds its own
GameTooltipTemplateframe instead and flags itLIKE_GLOBAL_GAMETOOLTIP, theestablished way of asking to be treated as the real thing. OPie does exactly this
(
Libs/NotGameTooltip.lua):These stand-ins are not going off on their own: they still anchor through
GameTooltip_SetDefaultAnchor, so our hook does fire for them. It just declineson the first line, and the tooltip keeps whatever Blizzard's default anchoring
gave it.
TooltipIsGlobalLikeaccepts the global tooltip or any frame carrying the flag,and is used for the anchor decision in those three places.
The armed-state bookkeeping deliberately stays on the global tooltip only.
_fixedArmedand_growthDefaultAnchoredgate SetPoint enforcement hooked ontoGameTooltip's own setters, so they can only ever describe one tooltip; armingthem for a stand-in would let a later
GameTooltip:SetPointbe enforced againststate belonging to a different frame. A stand-in gets the one-shot anchor at
default-anchor time, which is all it needs, since that enforcement exists for
Blizzard's container re-anchoring and Blizzard does not manage third-party frames.
Left on strict identity:
_repointTooltipAtCursor(only ever called by our ownframes with the global tooltip), the
FadeOutandSetPoint/SetOwnerhooks(bound to the
GameTooltipobject itself), and the Show Tooltips suppressionblock, which reparents into a hidden host and is a visibility feature rather than
an anchor one.
Ordering is unchanged and still correct: the fixed-anchor hook is registered
before the growth-direction hook, so a stand-in is positioned and then has its
growth corner forced, exactly as the global tooltip is.
How was it tested?
Live retail,
Interface: 120001, against OPie 8.6.3.bottom-right default container, ignoring the anchor box.
and to down, since all three shared the same identity check.
including the case the strict check was protecting: explicitly anchored
tooltips from other addons still keep their own anchors.
Screenshots
Checklist
HookScript/hooksecurefunconly, neverSetScripton Blizzard frames - unchanged; stillhooksecurefunconly, and the tooltip is unprotected with its content never touched