Replace saved-handler wrappers with HookScript; use intrinsic pre/postcall bindings for barbershop and SetHighlight

This commit is contained in:
Brues
2026-10-31 19:47:41 -05:00
parent b2e89b461c
commit 14a26b8301
7 changed files with 14 additions and 47 deletions
+2 -14
View File
@@ -257,20 +257,8 @@ function pfUI.api.SetHighlight(frame, cr, cg, cb)
frame.rr, frame.rg, frame.rb, frame.ra = GetStringColor(pfUI_config.appearance.border.color)
if not frame.pfEnterLeave then
local enter, leave = frame:GetScript("OnEnter"), frame:GetScript("OnLeave")
if enter then
frame:HookScript("OnEnter", SetHighlightEnter)
else
frame:SetScript("OnEnter", SetHighlightEnter)
end
if leave then
frame:HookScript("OnLeave", SetHighlightLeave)
else
frame:SetScript("OnLeave", SetHighlightLeave)
end
frame:HookScript("OnEnter", SetHighlightEnter, LE_SCRIPT_BINDING_TYPE_INTRINSIC_POSTCALL)
frame:HookScript("OnLeave", SetHighlightLeave, LE_SCRIPT_BINDING_TYPE_INTRINSIC_POSTCALL)
frame.pfEnterLeave = true
end
end
+1 -3
View File
@@ -96,12 +96,10 @@ end
libpredict:RegisterEvent("PLAYER_ENTERING_WORLD")
libpredict:RegisterEvent("RAID_ROSTER_UPDATE")
libpredict:RegisterEvent("PARTY_MEMBERS_CHANGED")
local origOnEvent = libpredict:GetScript("OnEvent")
libpredict:SetScript("OnEvent", function()
libpredict:HookScript("OnEvent", function()
if event == "PLAYER_ENTERING_WORLD" or event == "RAID_ROSTER_UPDATE" or event == "PARTY_MEMBERS_CHANGED" then
cacheRaidNames()
end
if origOnEvent then origOnEvent() end
end)
-- Own cast-time spell started (heals + rez)
+2 -6
View File
@@ -258,9 +258,7 @@ pfUI.marktracking = CreateFrame("Frame", "pfMarkTracking", UIParent)
-- Unlock mode: show fixed 1-row placeholder so positioning works correctly
if pfUI.unlock then
local origShow = pfUI.unlock:GetScript("OnShow")
pfUI.unlock:SetScript("OnShow", function()
if origShow then origShow() end
pfUI.unlock:HookScript("OnShow", function()
isUnlocked = true
-- hide all rows, show container at 1-row height as drag handle
for i = 1, 8 do
@@ -270,9 +268,7 @@ pfUI.marktracking = CreateFrame("Frame", "pfMarkTracking", UIParent)
pfUI.marktracking:Show()
end)
local origHide = pfUI.unlock:GetScript("OnHide")
pfUI.unlock:SetScript("OnHide", function()
if origHide then origHide() end
pfUI.unlock:HookScript("OnHide", function()
isUnlocked = false
UpdateDisplay()
end)
+3 -8
View File
@@ -885,18 +885,15 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
end
-- hook events to include SuperMacro refreshs
local ButtonEnter = pfUI.bars[1][1]:GetScript("OnEnter")
local function NewButtonEnter()
ButtonEnter()
local actionid = ActionButton_GetPagedID(this)
SM_ActionButton_SetTooltip(actionid)
SM_ActionButton_SetTooltip(ActionButton_GetPagedID(this))
end
-- reassign the new event handler
for i=1,10 do
for j=1,12 do
pfUI.bars[i][j]:SetScript("OnEvent", NewButtonEvent)
pfUI.bars[i][j]:SetScript("OnEnter", NewButtonEnter)
pfUI.bars[i][j]:HookScript("OnEnter", NewButtonEnter)
end
end
@@ -1045,9 +1042,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
if pfUI.uf.player then
-- set tooltip function for player frame
local oldfunc = pfUI.uf.player:GetScript("OnEnter")
pfUI.uf.player:SetScript("OnEnter", function()
oldfunc()
pfUI.uf.player:HookScript("OnEnter", function()
mrpDisplayTooltip("player", "PLAYER")
end)
end
+4 -8
View File
@@ -62,8 +62,7 @@ pfUI:RegisterSkin("Barbershop", function ()
-- to prevent SetUnitDebuff crash (TargetFrame is hidden but scripts remain active)
local savedOnEnter = {}
local origOnShow = BarbershopFrame:GetScript("OnShow")
BarbershopFrame:SetScript("OnShow", function()
BarbershopFrame:HookScript("OnShow", function()
for i = 1, 16 do
local debuff = _G["TargetFrameDebuff" .. i]
if debuff then
@@ -71,17 +70,14 @@ pfUI:RegisterSkin("Barbershop", function ()
debuff:SetScript("OnEnter", nil)
end
end
if origOnShow then origOnShow() end
end)
end, LE_SCRIPT_BINDING_TYPE_INTRINSIC_PRECALL)
local origOnHide = BarbershopFrame:GetScript("OnHide")
BarbershopFrame:SetScript("OnHide", function()
BarbershopFrame:HookScript("OnHide", function()
for i = 1, 16 do
local debuff = _G["TargetFrameDebuff" .. i]
if debuff and savedOnEnter[i] then
debuff:SetScript("OnEnter", savedOnEnter[i])
end
end
if origOnHide then origOnHide() end
end)
end, LE_SCRIPT_BINDING_TYPE_INTRINSIC_PRECALL)
end)
+1 -3
View File
@@ -87,9 +87,7 @@ pfUI:RegisterSkin("Transmog", function ()
end
end
local origOnShow = TransmogFrame:GetScript("OnShow")
TransmogFrame:SetScript("OnShow", function()
if origOnShow then origOnShow() end
TransmogFrame:HookScript("OnShow", function()
for i = 1, 20 do
SkinLookButton(_G["TransmogFrameLook" .. i])
end
+1 -5
View File
@@ -67,11 +67,7 @@ pfUI:RegisterSkin("Turtle Shop", function ()
-- ============================================================
SkinEntryFrames()
local origOnShow = ShopFrame:GetScript("OnShow")
ShopFrame:SetScript("OnShow", function()
if origOnShow then origOnShow() end
SkinEntryFrames()
end)
ShopFrame:HookScript("OnShow", SkinEntryFrames)
-- ============================================================
-- ShopDressUpFrame