From 0bd85dd4f3d28ec6cc6aa209150bbe14ea7ac13b Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 1 Aug 2026 22:52:37 -0500 Subject: [PATCH] tooltip: guard mouseover-clear recolor, fix white name flash (#12) The DLL now fires UPDATE_MOUSEOVER_UNIT on mouseover loss (retail parity). The stock FrameXML GameTooltip OnEvent recolors the name unconditionally via GameTooltip_UnitColor("mouseover"), which returns white when no mouseover exists -- so the loss fire (and the transient clear when clicking a unit) flashed NPC and PvP-flagged-player names white during the tooltip fade. Wrap the stock OnEvent in Util/GameTooltip.lua: swallow the event when UnitExists("mouseover") is false, otherwise delegate to the original untouched. The name keeps its color through the loss window and recolors normally when a mouseover resolves again. --- AddOns/!!!ClassicAPI/Util/GameTooltip.lua | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/AddOns/!!!ClassicAPI/Util/GameTooltip.lua b/AddOns/!!!ClassicAPI/Util/GameTooltip.lua index a8f1ac36..dd1f0fbc 100644 --- a/AddOns/!!!ClassicAPI/Util/GameTooltip.lua +++ b/AddOns/!!!ClassicAPI/Util/GameTooltip.lua @@ -90,3 +90,31 @@ function GameTooltip_ShowCompareItem(self, shift) end end end + +-- Guard the stock GameTooltip UPDATE_MOUSEOVER_UNIT handler (issue #12). +-- +-- ClassicAPI's DLL now fires UPDATE_MOUSEOVER_UNIT on mouseover LOSS too (retail +-- parity), not just on gain. The stock inline handler in FrameXML/GameTooltip.xml +-- recolors the name unconditionally: +-- _G[this:GetName().."TextLeft1"]:SetTextColor(GameTooltip_UnitColor("mouseover")) +-- and GameTooltip_UnitColor returns white (1,1,1) when "mouseover" doesn't exist. +-- So the loss fire (and the transient clear that happens when clicking a unit) +-- repaints the still-visible/fading name white before it disappears -- reported +-- as NPC and PvP-flagged-player names flashing white. +-- +-- We wrap the stock handler instead of replacing its body: swallow the event +-- only when there is no mouseover unit to color, otherwise delegate to the +-- original untouched. During the loss window the name simply keeps its last +-- color instead of going white; when a mouseover resolves again it recolors +-- normally. (1.12 OnEvent handlers read the `event`/`this` globals the engine +-- sets before invoking us, so calling the original as a plain function works.) +local originalOnEvent = GameTooltip:GetScript("OnEvent") +GameTooltip:SetScript("OnEvent", function() + if ( event == "UPDATE_MOUSEOVER_UNIT" and not UnitExists("mouseover") ) then + return; + end + + if ( originalOnEvent ) then + originalOnEvent(); + end +end)