Quantcast

Delay applying tooltip text and positioning a tick to work around a new WoW peculiarity(bug?) so unitframe tooltips work again

starlon [10-28-08 - 20:36]
Delay applying tooltip text and positioning a tick to work around a new WoW peculiarity(bug?) so unitframe tooltips work again
Filename
Modules/Position.lua
Modules/Text.lua
StarTip.lua
StarTip.toc
diff --git a/Modules/Position.lua b/Modules/Position.lua
index bd6437e..7ac613b 100644
--- a/Modules/Position.lua
+++ b/Modules/Position.lua
@@ -322,10 +322,14 @@ local setOffsets = function(owner)
 end

 local currentOwner
-function mod:GameTooltip_SetDefaultAnchor(this, owner)
+local currentThis
+local f = CreateFrame("Frame")
+local function delayAnchor()
+	f:SetScript("OnUpdate", nil)
+	local this = currentThis
+	local owner = currentOwner
 	this:ClearAllPoints()
 	setOffsets(owner)
-	currentOwner = owner
 	local index = getIndex(owner)
 	if index == #selections then
 		this:Hide()
@@ -341,6 +345,12 @@ function mod:GameTooltip_SetDefaultAnchor(this, owner)
 	end
 end

+function mod:GameTooltip_SetDefaultAnchor(this, owner)
+	currentOwner = owner
+	currentThis = this
+	if not f:GetScript("OnUpdate") then f:SetScript("OnUpdate", delayAnchor) end
+end
+
 function mod:REGEN_DISABLED()
 	if not currentOwner then return end
 	updateFrame:SetScript("OnUpdate", nil)
@@ -352,4 +362,3 @@ mod.REGEN_ENABLED = mod.REGEN_DISABLED
 function mod:OnHide()
 	updateFrame:SetScript("OnUpdate", nil)
 end
-
diff --git a/Modules/Text.lua b/Modules/Text.lua
index 99888bf..0190883 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -640,8 +640,19 @@ local getGuild = function()
 	return "<" .. left_2 .. ">"
 end

+local ff = CreateFrame("Frame")
 function mod:SetUnit()
-	if not UnitExists("mouseover") then return end
+	--[[self = mod
+	if not UnitExists("mouseover") then
+		if ff:GetScript("OnUpdate") then
+			ff:SetScript("OnUpdate", nil)
+		else
+			ff:SetScript("OnUpdate", self.SetUnit)
+		end
+		return
+	end]]
+
+	if ff:GetScript("OnUpdate") then ff:SetScript("OnUpdate", nil) end

 	unitName = getName()
 	unitLocation = getLocation()
@@ -714,4 +725,6 @@ function mod:SetUnit()
 	-- End

 	timer = timer or self:ScheduleRepeatingTimer(updateLines, .5)
+
+	GameTooltip:Show()
 end
diff --git a/StarTip.lua b/StarTip.lua
index 3d5d622..325d858 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -87,9 +87,9 @@ function StarTip:OnInitialize()
 end

 function StarTip:OnEnable()
-	self:RawHookScript(GameTooltip, "OnTooltipSetUnit")
-	self:RawHookScript(GameTooltip, "OnTooltipSetItem")
-	self:RawHookScript(GameTooltip, "OnTooltipSetSpell")
+	self:HookScript(GameTooltip, "OnTooltipSetUnit")
+	self:HookScript(GameTooltip, "OnTooltipSetItem")
+	self:HookScript(GameTooltip, "OnTooltipSetSpell")
 	self:RawHookScript(GameTooltip, "OnHide", "OnTooltipHide")
 	self:RawHookScript(GameTooltip, "OnShow", "OnTooltipShow")

@@ -112,10 +112,20 @@ function StarTip:OpenConfig()
 	AceConfigDialog:SetDefaultSize("StarTip", 500, 450)
 	AceConfigDialog:Open("StarTip")
 end
-
-function StarTip:OnTooltipSetUnit(...)
-	self.hooks[GameTooltip].OnTooltipSetUnit(...)
+
+local ff = CreateFrame("Frame")
+function StarTip:OnTooltipSetUnit()
 	if not self.justSetUnit then
+		if not UnitExists("mouseover") then
+			if ff:GetScript("OnUpdate") then
+				ff:SetScript("OnUpdate", nil)
+			else
+				ff:SetScript("OnUpdate", function() GameTooltip:SetUnit("mouseover") end)
+			end
+			return
+		else
+			if ff:GetScript("OnUpdate") then ff:SetScript("OnUpdate", nil) end
+		end
 		for k, v in self:IterateModules() do
 			if v.SetUnit and v:IsEnabled() then v:SetUnit() end
 		end
@@ -128,7 +138,6 @@ function StarTip:OnTooltipSetItem(...)
 			if v.SetItem and v:IsEnabled() then v:SetItem() end
 		end
 	end
-	self.hooks[GameTooltip].OnTooltipSetItem(...)
 end

 function StarTip:OnTooltipSetSpell(...)
@@ -137,7 +146,6 @@ function StarTip:OnTooltipSetSpell(...)
 			if v.SetSpell and v:IsEnabled() then v:SetSpell() end
 		end
 	end
-	self.hooks[GameTooltip].OnTooltipSetSpell(...)
 end

 function StarTip:OnTooltipHide(...)
diff --git a/StarTip.toc b/StarTip.toc
index 31fd378..96d9e35 100644
--- a/StarTip.toc
+++ b/StarTip.toc
@@ -27,3 +27,4 @@ Modules\PvP.lua
 Modules\RaidIcon.lua
 Modules\Targeting.lua
 Modules\Text.lua
+