Skip to content

Commit

Permalink
update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuller committed Nov 11, 2022
1 parent 810f2c8 commit 46699ad
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 84 deletions.
3 changes: 2 additions & 1 deletion Dominos/Dominos.toc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ localization.xml
Dominos.lua
core\helpers.lua
core\barStates.lua
core\secureEnv.lua
core\shadowUIParent.lua
core\frame.lua
core\buttonBar.lua
Expand Down Expand Up @@ -49,4 +50,4 @@ plugins\launcher.lua
plugins\buttonThemer.lua
plugins\getActionReagentUses.lua
plugins\multiActionBarFixer.classic.lua
plugins\showGridFixes.lua

28 changes: 6 additions & 22 deletions Dominos/bars/actionBar/bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function ActionBar:LoadStateController()
offset = (page - 1) * self:GetAttribute('barLength')
-- skip action bar 12 (not really usable)
if offset >= 132 then
if offset > 132 then
offset = offset + 12
end
end
Expand All @@ -226,30 +226,14 @@ end
function ActionBar:LoadShowGridController()
if not Addon:IsBuild("retail") then return end

self:SetAttribute("showgrid", 0)

self:SetAttribute('_onstate-cursor', [[
local reason = 2
local old = self:GetAttribute("showgrid") or 0
local new = old
if newstate > 0 then
if new % (2 * reason) < reason then
new = new + reason
end
else
if new % (2 * reason) >= reason then
new = new - reason
end
end
if old ~= new then
self:SetAttribute("showgrid", new)
control:ChildUpdate('showgrid', new)
self:SetAttribute('_onstate-showgrid', [[
if self:GetAttribute("showgrid") ~= newstate then
self:SetAttribute("showgrid", newstate)
control:ChildUpdate('showgrid', newstate)
end
]])

RegisterStateDriver(self, "cursor", "[cursor]2;0")
Addon:RegisterShowGridEvents(self)
end

function ActionBar:UpdateOverrideBar()
Expand Down
4 changes: 2 additions & 2 deletions Dominos/bars/actionBar/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Addon.ActionButtonMixin = ActionButtonMixin

local createActionButton
if Addon:IsBuild("retail") then
local source_OnAttributeChanged = [[
local actionButton_OnAttributeChanged = [[
if name ~= "action" then return end
local target = control:GetFrameRef("target")
Expand All @@ -133,7 +133,7 @@ if Addon:IsBuild("retail") then
-- mirror action attribute chagnes from button to target
local proxy = CreateFrame('Frame', nil, nil, "SecureHandlerBaseTemplate")
proxy:SetFrameRef("target", target)
proxy:WrapScript(button, "OnAttributeChanged", source_OnAttributeChanged)
proxy:WrapScript(button, "OnAttributeChanged", actionButton_OnAttributeChanged)
proxy:Hide()

hooksecurefunc(target, "SetButtonStateBase", function(_, state)
Expand Down
4 changes: 1 addition & 3 deletions Dominos/core/blizzardHider.classic.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
local _, Addon = ...

if Addon:IsBuild('retail') then
return
end
if Addon:IsBuild('retail') then return end

local CLASS = UnitClassBase('player')

Expand Down
4 changes: 2 additions & 2 deletions Dominos/core/blizzardHider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ local function apply(func, ...)
end

local function banishFrames(...)
local function hide(frame)
local function banish(frame)
frame:Hide()
frame:SetParent(Addon.ShadowUIParent)
end

return apply(hide, ...)
return apply(banish, ...)
end

local function unregisterEventsForFrames(...)
Expand Down
4 changes: 3 additions & 1 deletion Dominos/core/overrideController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function OverrideController:OnLoad()
end

self:SetAttribute('updateOverridePage', [[
local newPage = 0
local newPage
if HasVehicleActionBar and HasVehicleActionBar() then
newPage = GetVehicleBarIndex() or 0
Expand All @@ -92,6 +92,8 @@ function OverrideController:OnLoad()
newPage = GetTempShapeshiftBarIndex() or 0
elseif GetBonusBarOffset() > 4 then
newPage = GetBonusBarOffset() or 0
else
newPage = 0
end
self:SetAttribute('state-overridepage', newPage)
Expand Down
113 changes: 113 additions & 0 deletions Dominos/core/secureEnv.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
--------------------------------------------------------------------------------
-- A centralized handler for global state that we need to handle securely.
-- Or, a one stop shop for all of the hacks I need to work around the stock
-- ui not doing things in a secure manner
--------------------------------------------------------------------------------

local _, Addon = ...
if not Addon:IsBuild("retail") then return end

local Env = CreateFrame('Frame', nil, nil, 'SecureHandlerAttributeTemplate')
Env:Execute([[ WATCHERS = table.new() ]])
Env:Hide()

--------------------------------------------------------------------------------
-- detection
--------------------------------------------------------------------------------

-- detect ACTION_BUTTON_SHOW_GRID_REASON_EVENT changes
-- requirements: MainActionBar needs to have its events registered
do
-- initialize
Env:SetAttribute("showgrid", 0)

local target = MainMenuBar.actionButtons[1]

-- initialize state
target:SetAttribute("showgrid", 0)

-- watch for changes
local target_OnAttributeChanged = ([[
if name ~= "showgrid" then return end
local reason = %d
local result
if value %% (2 * reason) >= reason then
result = reason
else
result = 0
end
if control:GetAttribute(name) ~= result then
control:SetAttribute(name, result)
control:SetAttribute("saving-" .. name, 1)
end
]]):format(ACTION_BUTTON_SHOW_GRID_REASON_EVENT)

Env:WrapScript(target, "OnAttributeChanged", target_OnAttributeChanged)

-- delay updates until the next frame to avoid issues around saving the
-- state of buttons we've just added actions to
RegisterAttributeDriver(Env, "saving-showgrid", 0)
end

--------------------------------------------------------------------------------
-- event handling
--------------------------------------------------------------------------------

Env:SetAttribute("Notify", [[
local key = ...
local value = self:GetAttribute(key)
local watchers = WATCHERS[key]
if watchers then
for frame in pairs(watchers) do
frame:SetAttribute("state-" .. key, value)
end
end
]])

Env:SetAttribute("saving-showgrid-changed", [[
local _, saving = ...
if saving == 0 then
self:RunAttribute("Notify", "showgrid")
end
]])

-- watch for attribute changes, run an associated attribute-changed handler
Env:SetAttribute("_onattributechanged", [[
local body = self:GetAttribute(name .. "-changed")
if body then
self:Run(body, name, value)
end
]])

--------------------------------------------------------------------------------
-- subscriptions
--------------------------------------------------------------------------------

-- like and subscribe
local function watch(frame, attribute)
Env:SetFrameRef("watcher", frame)

local method = ([[
local attribute = %q
local frame = self:GetFrameRef("watcher")
local watchers = WATCHERS[attribute]
if not watchers then
watchers = table.new()
WATCHERS[attribute] = watchers
end
watchers[frame] = true
frame:SetAttribute("state-" .. attribute, self:GetAttribute(attribute))
]]):format(attribute)

Env:Execute(method)
end

function Addon:RegisterShowGridEvents(frame)
watch(frame, "showgrid")
end
53 changes: 0 additions & 53 deletions Dominos/plugins/showGridFixes.lua

This file was deleted.

4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Dominos Changelog

## 10.0.6

* Fix showing empty buttons not working in combat

## 10.0.5

* The exit vehicle button should work under more scenarios now
Expand Down

0 comments on commit 46699ad

Please sign in to comment.