Commit a57fd022 authored by syndenbock's avatar syndenbock
Browse files

Merge branch 'fix/bag-close-detection' into development

parents d2e8b325 e36ddd40
......@@ -11,6 +11,7 @@ local type, ipairs, pairs, unpack, select, assert, pcall = type, ipairs, pairs,
local tinsert, tremove, wipe, tmaxn = tinsert, tremove, wipe, table.maxn
local next, floor, ceil, abs = next, floor, ceil, abs
local format, sub = format, strsub
local executeAfter = C_Timer.After
local GetCVarBool = GetCVarBool
local UnitAffectingCombat = UnitAffectingCombat
......@@ -1064,6 +1065,25 @@ function B:UpdateAll()
B:Layout(true)
end
local flaggedFrames = {};
local update = false;
local function processFlags ()
for frame, count in pairs(flaggedFrames) do
if (frame:IsShown()) then
B:UpdateCooldowns(frame)
if (count > 0) then
print(frame:GetName(), 'skipped count:', count)
end
else
print(frame:GetName(), 'is currently hidden')
end
end
wipe(flaggedFrames)
update = false;
end
function B:OnEvent(event, ...)
if event == 'ITEM_LOCK_CHANGED' then
B:UpdateSlot(self, ...)
......@@ -1081,7 +1101,11 @@ function B:OnEvent(event, ...)
--Refresh search in case we moved items around
if B:IsSearching() then B:RefreshSearch() end
elseif event == 'BAG_UPDATE_COOLDOWN' then
B:UpdateCooldowns(self)
if (not update) then
update = true;
executeAfter(0, processFlags);
end
flaggedFrames[self] = (flaggedFrames[self] or -1) + 1
elseif event == 'PLAYERBANKSLOTS_CHANGED' then
local slot = ...
local bagID = (slot <= NUM_BANKGENERIC_SLOTS) and -1 or (slot - NUM_BANKGENERIC_SLOTS)
......@@ -1869,7 +1893,7 @@ function B:ToggleSortButtonState(isBank)
end
function B:OpenBags()
-- print('opening bags')
print('opening bags')
B.BagFrame:Show()
B.BagFrame:RegisterEvent('BAG_UPDATE')
......@@ -1884,7 +1908,7 @@ function B:OpenBags()
end
function B:ClearBagListeners ()
-- print('closing bags')
print('closing bags')
B.BagFrame:UnregisterEvent('BAG_UPDATE')
B.BagFrame:UnregisterEvent('BAG_UPDATE_COOLDOWN')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment