mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Refresh action bars on ClassicAPI's global mouse events
A [button:N] macro's icon never moved. The conditional reads IsMouseButtonDown live, but nothing ever noticed that state changing: the OnUpdate's input poll samples alt/shift/ctrl only, and no event fired for a mouse button, so no refresh was queued and the icon sat on whatever the macro resolved to with no button held. ClassicAPI fires GLOBAL_MOUSE_DOWN / GLOBAL_MOUSE_UP on every raw press and release, whether or not the click lands on a frame. Registering both and queuing an action update is the whole fix -- the existing path re-runs TestAction per action, so the conditional is read fresh and PublishDisplay hands the new answer to C_Macro.SetMacroDisplay. Ungated, unlike the Nampower-backed input events next to it: GLOBAL_MOUSE_* has been in ClassicAPI since v1.0.0, far below the v1.15.0 floor the addon already refuses to run below. The handlers set isActionUpdateQueued directly rather than calling QueueActionUpdate, as KEY_DOWN does: these fire from the message pump, which can beat VARIABLES_LOADED to the CleveRoidMacros table QueueActionUpdate reads. arg1 carries the button name and goes deliberately unused. The mask behind IsMouseButtonDown is maintained by the same hook that fires the event, so mirroring the payload into Lua would copy state the API already exposes -- and the refresh covers every macro regardless, since any of them may test any button.
This commit is contained in:
@@ -4516,6 +4516,12 @@ if CleveRoids.NampowerAPI.features.hasKeyEvents then
|
||||
CleveRoids.Frame:RegisterEvent("KEY_UP")
|
||||
end
|
||||
|
||||
-- ClassicAPI raw mouse-button events, for [button:N] icon refresh. Ungated,
|
||||
-- unlike the Nampower features above: these long predate the ClassicAPI v1.15.0
|
||||
-- floor the addon already refuses to run below.
|
||||
CleveRoids.Frame:RegisterEvent("GLOBAL_MOUSE_DOWN")
|
||||
CleveRoids.Frame:RegisterEvent("GLOBAL_MOUSE_UP")
|
||||
|
||||
-- NOTE: SuperMacro hook installation is handled by Compatibility/SuperMacro.lua
|
||||
-- which has the complete implementation including the INTERCEPT path for all commands
|
||||
|
||||
@@ -5567,6 +5573,22 @@ function CleveRoids.Frame:KEY_UP()
|
||||
CleveRoids.isActionUpdateQueued = true
|
||||
end
|
||||
|
||||
-- ClassicAPI GLOBAL_MOUSE_DOWN / GLOBAL_MOUSE_UP: arg1 = button name
|
||||
-- ("LeftButton" .. "Button5"), fired on every raw press/release whether or not
|
||||
-- the click lands on a frame. [button:N] reads IsMouseButtonDown live, but
|
||||
-- nothing sampled that state -- the OnUpdate polls modifier keys only -- so a
|
||||
-- [button:N] macro's icon sat on whatever it resolved to with no button held.
|
||||
-- Flag set directly rather than through QueueActionUpdate, as with KEY_DOWN:
|
||||
-- these fire from the message pump, which can beat VARIABLES_LOADED to the
|
||||
-- CleveRoidMacros table QueueActionUpdate reads.
|
||||
function CleveRoids.Frame:GLOBAL_MOUSE_DOWN()
|
||||
CleveRoids.isActionUpdateQueued = true
|
||||
end
|
||||
|
||||
function CleveRoids.Frame:GLOBAL_MOUSE_UP()
|
||||
CleveRoids.isActionUpdateQueued = true
|
||||
end
|
||||
|
||||
-- Base SendChatMessage captured at first hook; used to break a hook cycle.
|
||||
local baseSendChatMessage = SendChatMessage
|
||||
local sendingChatMessage = false
|
||||
|
||||
Reference in New Issue
Block a user