Quantcast

Added support for extra mouse buttons

James Whitehead II [11-02-09 - 15:01]
Added support for extra mouse buttons
Filename
Clique.lua
CliqueUtils.lua
diff --git a/Clique.lua b/Clique.lua
index cd01189..0b758d4 100644
--- a/Clique.lua
+++ b/Clique.lua
@@ -527,20 +527,6 @@ function Clique:DeleteAction(entry)
 	end
 end

-local mods = {"Shift", "Ctrl", "Alt"}
-local buttonsraw = {1,2,3,4,5}
-local buttonmods = {"-help", "-harm"}
-
-local buttons = {}
-for idx,button in pairs(buttonsraw) do
-	for k,v in pairs(buttonmods) do
-		table.insert(buttons, v..button)
-	end
-end
-for k,v in pairs(buttonsraw) do
-	table.insert(buttons, v)
-end
-
 function Clique:ShowAttributes()
 	self:Print("Enabled enhanced debugging.")
 	PlayerFrame:SetScript("OnAttributeChanged", function(...) self:Print(...) end)
diff --git a/CliqueUtils.lua b/CliqueUtils.lua
index e508152..a2f49a7 100644
--- a/CliqueUtils.lua
+++ b/CliqueUtils.lua
@@ -1,15 +1,12 @@
-local buttonMap = {
+local buttonMap = setmetatable({
     [1] = "LeftButton",
     [2] = "RightButton",
     [3] = "MiddleButton",
-    [4] = "Button4",
-    [5] = "Button5",
-    LeftButton = 1,
-    RightButton = 2,
-    MiddleButton = 3,
-    Button4 = 4,
-    Button5 = 5,
-}
+}, {
+    __index = function(t, k)
+        return "Button" .. k
+    end
+})

 function Clique:GetModifierText()
     local modifier = ""
@@ -28,8 +25,7 @@ function Clique:GetModifierText()
 end

 function Clique:GetButtonNumber(button)
-    if not button then return "" end
-    return buttonMap[arg1] or ""
+    return SecureButton_GetButtonSuffix(button)
 end

 function Clique:GetButtonText(num)
@@ -48,4 +44,4 @@ function Clique:CheckBinding(key)
             return v
         end
     end
-end
\ No newline at end of file
+end