-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix taint issues related to the multi action bars
this time in hopefully a better way
- Loading branch information
Showing
5 changed files
with
55 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--[[ | ||
This code works around empty action buttons appearing on the multi action | ||
buttons either because the user has set to always show blizzard slots, or | ||
because the user has opened the spellbook | ||
We do this via clearing specific showgrid reasons on all the buttons on | ||
each MultiActionBar whenever the showgrid value changes | ||
--]] | ||
|
||
local MultiBarFixer = CreateFrame("Frame", nil, nil, "SecureHandlerBaseTemplate") | ||
|
||
MultiBarFixer:Hide() | ||
|
||
-- adapted from http://lua-users.org/wiki/BitUtils | ||
MultiBarFixer:SetAttribute("ClearFlags", [[ | ||
local set = ... | ||
for i = 2, select("#", ...) do | ||
local flag = select(i, ...) | ||
if set % (2 * flag) >= flag then | ||
set = set - flag | ||
end | ||
end | ||
return set | ||
]]) | ||
|
||
-- clears the given show grid reasons | ||
local OnAttributeChanged = ([[ | ||
if name == "showgrid" and value > 0 then | ||
value = control:RunAttribute("ClearFlags", value, %d, %d) | ||
if self:GetAttribute("showgrid") ~= value then | ||
self:SetAttribute("showgrid", value) | ||
end | ||
end | ||
]]):format(ACTION_BUTTON_SHOW_GRID_REASON_CVAR, ACTION_BUTTON_SHOW_GRID_REASON_SPELLBOOK) | ||
|
||
-- apply to every multi bar action button | ||
for _, barName in pairs{'MultiBarBottomLeft', 'MultiBarBottomRight', 'MultiBarLeft', 'MultiBarRight'} do | ||
for i = 1, NUM_MULTIBAR_BUTTONS do | ||
local buttonName = ('%sButton%d'):format(barName, i) | ||
local button = _G[buttonName] | ||
|
||
MultiBarFixer:WrapScript(button, "OnAttributeChanged", OnAttributeChanged) | ||
end | ||
end |