From 94be5a2a4bfc8fd4f21e77e7e4adda25b50e53e3 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Tue, 12 Apr 2011 17:38:37 +0100 Subject: [PATCH] Attempt to fix the dangling bindings issue If the player is over a frame that has key bindings active and that frame is hidden or obscured then those bindings will remain active until another Clique-enabled frame is moused over. This fix uses the attribute driver template to clear this dangling button when the player no longer has a 'mouseover' unit. This change could potentially cause problems for small corner cases where non-unit-frames are enabled for Clique casting, but I do not currently know of any uses where this is the case. --- Clique.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Clique.lua b/Clique.lua index 3599f67..d994f70 100755 --- a/Clique.lua +++ b/Clique.lua @@ -53,9 +53,19 @@ function addon:Initialize() self.hccframes = {} -- Registration for group headers (in-combat safe) - self.header = CreateFrame("Frame", addonName .. "HeaderFrame", UIParent, "SecureHandlerBaseTemplate") + self.header = CreateFrame("Frame", addonName .. "HeaderFrame", UIParent, "SecureHandlerBaseTemplate,SecureHandlerAttributeTemplate") ClickCastHeader = addon.header + self.header:SetAttribute("_onattributechanged", [[ + if name == "hasunit" then + if value == "false" and danglingButton then + self:RunFor(danglingButton, self:GetAttribute("setup_onleave")) + danglingButton = nil + end + end + ]]) + RegisterAttributeDriver(self.header, "hasunit", "[@mouseover, exists] true; false") + -- Create a secure action button that can be used for 'hovercast' and 'global' self.globutton = CreateFrame("Button", addonName .. "SABButton", UIParent, "SecureActionButtonTemplate, SecureHandlerBaseTemplate") @@ -128,7 +138,7 @@ function addon:Initialize() -- We need to track frame registrations so we can display secure frames in -- the frame blacklist editor. This is done via the 'export_register' and -- 'export_unregister' attributes. - self.header:SetScript("OnAttributeChanged", function(frame, name, value) + self.header:HookScript("OnAttributeChanged", function(frame, name, value) if name == "export_register" and type(value) ~= nil then -- Convert the userdata object to the global object so we have access -- to all of the correct methods, such as 'RegisterForClicks'' -- 1.7.9.5