From caf71126511f60de3df78903488623861c338aa0 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 31 Oct 2026 14:28:01 -0500 Subject: [PATCH] Scan chat bubbles once per frame with DirtiableMixin Each chat message queued its own scan for the next frame, so a busy frame scanned the same bubbles several times. MarkDirty runs one scan for all of that frame's messages. --- modules/bubbles.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/bubbles.lua b/modules/bubbles.lua index 8d98cbdf..2e31147f 100644 --- a/modules/bubbles.lua +++ b/modules/bubbles.lua @@ -2,7 +2,7 @@ pfUI:RegisterModule("bubbles", function () local alpha = tonumber(C.chat.bubbles.alpha) - pfUI.bubbles = CreateFrame("Frame", "pfChatBubbles", UIParent) + pfUI.bubbles = Mixin(CreateFrame("Frame", "pfChatBubbles", UIParent), DirtiableMixin) pfUI.bubbles:RegisterEvent("CHAT_MSG_SAY") pfUI.bubbles:RegisterEvent("CHAT_MSG_YELL") pfUI.bubbles:RegisterEvent("CHAT_MSG_PARTY") @@ -11,12 +11,6 @@ pfUI:RegisterModule("bubbles", function () pfUI.bubbles:RegisterEvent("CHAT_MSG_MONSTER_YELL") pfUI.bubbles:RegisterEvent("CHAT_MSG_MONSTER_PARTY") - pfUI.bubbles:SetScript("OnEvent", function() - -- Bubble frames are attached to WorldFrame after the chat event fires, - -- so wait one tick before scanning. - RunNextFrame(function() pfUI.bubbles:ScanBubbles() end) - end) - function pfUI.bubbles:ProcessBubble(f) f.text:Hide() f.text:SetFont(pfUI.font_default, tonumber(C.global.font_size) * UIParent:GetScale(), "OUTLINE") @@ -62,4 +56,9 @@ pfUI:RegisterModule("bubbles", function () end end end + + -- Bubble frames are attached to WorldFrame after the chat event fires, so + -- the scan waits a frame, and runs once for all of that frame's messages. + pfUI.bubbles:SetDirtyMethod(pfUI.bubbles.ScanBubbles) + pfUI.bubbles:SetScript("OnEvent", pfUI.bubbles.MarkDirty) end)