Skip to content

Commit

Permalink
minimize some possible sources of taint
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Jan 28, 2024
1 parent bb1dc5a commit 6783402
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Dominos/bars/actionBar/bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function ActionBar:AcquireButton(index)

button:Show()

button.displayName = L.ActionBarButtonDisplayName:format(self.id, index)
button:SetAttributeNoHandler("displayName", L.ActionBarButtonDisplayName:format(self.id, index))

return button
end
Expand Down
8 changes: 2 additions & 6 deletions Dominos/bars/actionBar/button.classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ end

function ActionButton:OnCreate(id)
-- initialize state
self.id = id
self.action = 0

if self.commandName == nil then
self.commandName = GetActionButtonCommand(id)
self:SetAttributeNoHandler("commandName", GetActionButtonCommand(id))
end

-- initialize secure state
Expand All @@ -72,8 +69,7 @@ function ActionButton:OnCreate(id)
Addon.BindableButton:AddQuickBindingSupport(self)
self:UpdateHotkeys()

-- hide b default
self:SetAttributeNoHandler("showgrid", 0)
-- hide by default
self:Hide()
end

Expand Down
15 changes: 9 additions & 6 deletions Dominos/bars/actionBar/buttons.classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,31 +110,32 @@ local function GetActionButtonName(id)
return ACTION_BUTTON_NAME_TEMPLATE:format(id)
-- 3
elseif id <= 36 then
return "MultiBarRightButton" .. (id - 24)
return "MultiBarRightButton" .. (id - 24), true
-- 4
elseif id <= 48 then
return "MultiBarLeftButton" .. (id - 36)
return "MultiBarLeftButton" .. (id - 36), true
-- 5
elseif id <= 60 then
return "MultiBarBottomRightButton" .. (id - 48)
return "MultiBarBottomRightButton" .. (id - 48), true
-- 6
elseif id <= 72 then
return "MultiBarBottomLeftButton" .. (id - 60)
return "MultiBarBottomLeftButton" .. (id - 60), true
-- 7+
else
return ACTION_BUTTON_NAME_TEMPLATE:format(id)
end
end

function ActionButtons:GetOrCreateActionButton(id, parent)
local name = GetActionButtonName(id)
local name, noGrid = GetActionButtonName(id)
local button = _G[name]

-- a button we're creating
if button == nil then
button = CreateFrame("CheckButton", name, parent, "ActionBarButtonTemplate")

Mixin(button, Addon.ActionButton)

button:OnCreate(id)
self:WrapScript(button, "OnClick", ActionButton_ClickBefore)

Expand All @@ -144,7 +145,9 @@ function ActionButtons:GetOrCreateActionButton(id, parent)
Mixin(button, Addon.ActionButton)

button:SetID(0)
button.noGrid = true
if noGrid then
button.noGrid = true
end
button:OnCreate(id)
self:WrapScript(button, "OnClick", ActionButton_ClickBefore)

Expand Down
3 changes: 2 additions & 1 deletion Dominos/core/bindableButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ local COMMAND_TEMPLATE = 'CLICK %s:HOTKEY'
-- to enable cast on key press support
local function getButtonBindingAction(button)
return button.commandName
or button:GetAttribute("commandName")
or COMMAND_TEMPLATE:format(button:GetName())
end

local function getButtonBindingActionName(button)
local displayName = button.displayName
local displayName = button.displayName or button:GetAttribute("displayName")
if displayName then
return displayName
end
Expand Down

0 comments on commit 6783402

Please sign in to comment.