Quantcast

Allow click bypass for 3rd party support

Adrian L Lange [05-27-13 - 20:42]
Allow click bypass for 3rd party support
Filename
Molinari.lua
diff --git a/Molinari.lua b/Molinari.lua
index 2d68f23..326be6a 100644
--- a/Molinari.lua
+++ b/Molinari.lua
@@ -13,6 +13,22 @@ local function ScanTooltip(self, spells)
 	end
 end

+local scripts = {'OnClick', 'OnMouseUp', 'OnMouseDown'}
+
+local function ParentClick(self, button, ...)
+	if(button ~= 'LeftButton') then
+		local _, parent = self:GetPoint()
+		if(parent) then
+			for _, script in pairs(scripts) do
+				local handler = parent:GetScript(script)
+				if(handler) then
+					handler(parent, button, ...)
+				end
+			end
+		end
+	end
+end
+
 local function ApplyButton(itemLink, spell, r, g, b)
 	local slot = GetMouseFocus()
 	local bag = slot:GetParent():GetID()
@@ -60,9 +76,11 @@ function button:PLAYER_LOGIN()
 		end
 	end)

+	self:RegisterForClicks('AnyUp')
 	self:SetFrameStrata('TOOLTIP')
 	self:SetAttribute('alt-type1', 'spell')
 	self:SetScript('OnLeave', self.MODIFIER_STATE_CHANGED)
+	self:HookScript('OnClick', ParentClick)

 	self:RegisterEvent('MODIFIER_STATE_CHANGED')
 	self:Hide()