|
Following up on the research in this thread:
http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=212455&p=1&tmp=1#post212455
There's a bug/logic error in FCF_OnUpdate regarding the handling of flashing chat frames...
At the END of the function is a piece of code which fades in all of the docked chat tabs if showAllDockTabs is set.
However, in the middle of the loop is code that fades OUT any chat tabs which are not hovered over, and the two of them contradict each other ever frame creating a lot of temporary tables and wasting a lot of CPU cycles. Also, right now beecause of this the chat tabs DONT show up when blinking, even though they're supposed to!
There's a couple of fixes for this, but here's what I think is the simplest in terms of change to the function:
1) Add a new local variable, hideAnyDockTabs at around line 851
-- Handle hiding and showing chat tabs
local showAllDockTabs = nil;
local hideAnyDockTabs = nil; -- NEW VARIABLE
local xPos, yPos = GetCursorPosition();
2) Update the test at line 919 to have a second if clause:
if ( chatTab.hasBeenFaded ) then
if (chatFrame.isDocked) then -- NEW LINE
hideAnyDockTabs = true; -- NEW LINE
chatTab.needsHide = true; -- NEW LINE
else -- NEW LINE
local fadeInfo = {};
fadeInfo.mode = "OUT";
fadeInfo.startAlpha = chatTab.oldAlpha;
fadeInfo.timeToFade = CHAT_FRAME_FADE_TIME;
fadeInfo.finishedArg1 = chatTab;
fadeInfo.finishedArg2 = getglobal("ChatFrame"..chatTab:GetID());
fadeInfo.finishedFunc = FCF_ChatTabFadeFinished;
UIFrameFade(chatTab, fadeInfo);
chatFrame.hover = nil;
chatTab.hasBeenFaded = nil;
end -- NEW LINE
This defers handling docked frames until the proper value of showAllDockTabs is known (and it's not known until the END of that loop)
3) Update the showAllDockTabs loop at the end (Line 941):
-- If one tab is flashing, show all the docked tabs
if ( showAllDockTabs ) then
for index, value in DOCKED_CHAT_FRAMES do
chatTab = getglobal(value:GetName().."Tab");
chatTab.needsHide = nil; -- NEW LINE
if ( not chatTab.hasBeenFaded ) then
if ( SELECTED_DOCK_FRAME:GetID() == chatTab:GetID() ) then
UIFrameFadeIn(chatTab, CHAT_FRAME_FADE_TIME);
chatTab.oldAlpha = 1;
else
UIFrameFadeIn(chatTab, CHAT_FRAME_FADE_TIME, 0, 0.5);
chatTab.oldAlpha = 0.5;
end
chatTab.hasBeenFaded = 1;
end
end
-- BEGIN NEW BLOCK
elseif ( hideAnyDockTabs) then
for index, value in DOCKED_CHAT_FRAMES do
chatTab = getglobal(value:GetName().."Tab");
if (chatTab.needsHide) then
local fadeInfo = {};
fadeInfo.mode = "OUT";
fadeInfo.startAlpha = chatTab.oldAlpha;
fadeInfo.timeToFade = CHAT_FRAME_FADE_TIME;
fadeInfo.finishedArg1 = chatTab;
fadeInfo.finishedArg2 = getglobal("ChatFrame"..chatTab:GetID());
fadeInfo.finishedFunc = FCF_ChatTabFadeFinished;
UIFrameFade(chatTab, fadeInfo);
chatFrame.hover = nil;
chatTab.hasBeenFaded = nil;
chatTab.needsHide = nil;
end
end -- END NEW BLOCK
end
Applying those changes eliminates the problem on my machine (and fixes it so blinking tabs show up again).
Note: I tried a different approach in which I did a pre-scan of the frames to set the showAllDockTabs value early, but that got messy because of the test for hover over the default chat frame.[ post edited by Iriel ]
> Use ## SavedVariables: instead of RegisterForSave()
|