diff Bar.lua @ 70:2c12e2b1752e

Fixed unbinding a keystate toggle
author Flick <flickerstreak@gmail.com>
date Tue, 03 Jun 2008 23:24:03 +0000
parents fcb5dad031f9
children 3d2cef5dc459
line wrap: on
line diff
--- a/Bar.lua	Tue Jun 03 23:05:16 2008 +0000
+++ b/Bar.lua	Tue Jun 03 23:24:03 2008 +0000
@@ -182,11 +182,11 @@
   SecureStateHeader_Refresh(self.frame)
 end
 
-function Bar:SetStateKeybind(keybind, state, defaultstate)
+function Bar:SetStateKeybind(key, state, defaultstate)
   -- use a tiny offscreen button to get around making the bar itself a clickable button
   local f = self.statebuttonframe
   local off = ("%s_off"):format(state)
-  if keybind then
+  if key then
     if not f then
       f = CreateFrame("Button",self:GetName().."_statebutton",UIParent,"SecureActionButtonTemplate")
       f:SetPoint("BOTTOMRIGHT",UIParent,"TOPLEFT")
@@ -204,10 +204,15 @@
     f:SetAttribute(("type-%s"):format(off),"attribute")
     f:SetAttribute(("attribute-value-%s"):format(state), state)
     f:SetAttribute(("attribute-value-%s"):format(off), defaultstate)
-    SetBindingClick(keybind, f:GetName(), state)
+    SetBindingClick(key, f:GetName(), state)
   elseif f then
     f:SetAttribute(("type-%s"):format(state),ATTRIBUTE_NOOP)
     f:SetAttribute(("type-%s"):format(off),ATTRIBUTE_NOOP)
+    local action = ("CLICK %s:%s"):format(f:GetName(),state)
+    key = GetBindingKey(action)
+    if key then
+      SetBinding(key,nil)
+    end
   end
 end