diff ReAction.lua @ 92:5f1d7a81317c

- Various bugfixes - Switched action bar paging/mc fully to the _childupdate method
author Flick <flickerstreak@gmail.com>
date Fri, 17 Oct 2008 22:43:57 +0000
parents c2504a8b996c
children 168cae4aa8bd
line wrap: on
line diff
--- a/ReAction.lua	Fri Oct 17 03:59:55 2008 +0000
+++ b/ReAction.lua	Fri Oct 17 22:43:57 2008 +0000
@@ -107,13 +107,19 @@
 }
 ReAction.options = options
 
-local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, CallModuleMethod, SlashHandler
+local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, CallModuleMethod, SlashHandler, KBAttach
 do
   local pcall = pcall
   local geterrorhandler = geterrorhandler
   local self = ReAction
   local inited = false
 
+  local function kb_onEnter( self )
+    if ReAction:GetKeybindMode() then
+      KB:Set(self)
+    end
+  end
+
   function SelectBar(x)
     local bar, name
     if type(x) == "string" then
@@ -214,6 +220,16 @@
       self:Print("/rxn kb")
     end
   end
+
+  function KBAttach( frame )
+    if not private.kbHooked[frame] then
+      -- avoid taint, particularly with SecureAnchorEnterTemplate
+      -- don't hook scripts multiple times, there isn't any unhook!
+      frame:HookScript("OnEnter",kb_onEnter)
+      private.kbHooked[frame] = true
+    end
+  end
+
 end
 
 
@@ -487,26 +503,11 @@
   CallModuleMethod("ConfigUI","LaunchBarEditor",bar, ...)
 end
 
-
-local kb_onEnter
-do
-  function kb_onEnter( self )
-    if ReAction:GetKeybindMode() then
-      KB:Set(self)
-    end
-  end
-end
-
 function ReAction:SetKeybindMode( mode )
   if mode ~= private.kbMode then
     if mode then
       for f in pairs(private.allKB) do
-        if not private.kbHooked[f] then
-          -- avoid taint, particularly with SecureAnchorEnterTemplate
-          -- don't hook scripts multiple times, there isn't any unhook!
-          f:HookScript("OnEnter",kb_onEnter)
-          private.kbHooked[f] = true
-        end
+        KBAttach(f)
       end
       KB:Activate()
     else
@@ -522,6 +523,9 @@
 
 function ReAction:RegisterKeybindFrame( f )
   private.allKB[f] = true
+  if private.kbMode then
+    KBAttach(f)
+  end
 end
 
 function ReAction:FreeOverrideHotkey( key )