View Single Post
09-21-22, 06:08 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Here's the OnClick handler on PTR.

Lua Code:
  1. function SecureActionButton_OnClick(self, inputButton, down, isKeyPress)
  2.     local pressAndHoldAction = SecureButton_GetAttribute(self, "pressAndHoldAction");
  3.     local useOnKeyDown = GetCVarBool("ActionButtonUseKeyDown") or pressAndHoldAction;
  4.     local clickAction = (down and useOnKeyDown) or (not down and not useOnKeyDown);
  5.     local releasePressAndHoldAction = (not down) and (pressAndHoldAction or GetCVarBool("ActionButtonUseKeyHeldSpell"));
  6.  
  7.     if clickAction then
  8.         OnActionButtonClick(self, inputButton, down, isKeyPress);
  9.         return true;
  10.     elseif releasePressAndHoldAction then
  11.         OnActionButtonPressAndHoldRelease(self, inputButton, isKeyPress);
  12.         return true;
  13.     end
  14.  
  15.     return false;
  16. end
-FrameXML\SecureTemplates.lua:730

Basically, the handler is looking for either an up or down click event specifically according to how the ActionButtonUseKeyDown CVar is set. If it never gets the matching click event, the code never runs. It's probably a good idea to register both up and down click events for every button you intend to respond to. If you don't care about registering individual buttons, you can use "AnyUp" and "AnyDown".



Originally Posted by Zax View Post
the real macro is something like "/wm 1" or "/cwm 1" to place or clear ground markers.
This code clip may be of interest to you.
Lua Code:
  1. SECURE_ACTIONS.worldmarker =
  2.     function(self, unit, button)
  3.         local marker = tonumber(SecureButton_GetModifiedAttribute(self, "marker", button));
  4.         local action = SecureButton_GetModifiedAttribute(self, "action", button) or "toggle";
  5.         if ( action == "set" ) then
  6.             PlaceRaidMarker(marker or 1);
  7.         elseif ( action == "clear" ) then
  8.             ClearRaidMarker(marker);
  9.         elseif ( action == "toggle" ) then
  10.             marker = marker or 1;
  11.             if ( IsRaidMarkerActive(marker) ) then
  12.                 ClearRaidMarker(marker);
  13.             else
  14.                 PlaceRaidMarker(marker);
  15.             end
  16.         end
  17.     end;
-FrameXML\SecureTemplates.lua:589

This defines type "worldmarker" with parameters "marker" and "action".
As with any other attribute fetched by SecureButton_GetModifiedAttribute(), you can append the attribute name (not the value) with a number representing the mouse button to bind to (1=Left, 2=Right, 3=Middle, etc.)
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 09-21-22 at 06:30 PM.
  Reply With Quote