From 55225dcef4571d9eef3d7a9bbd54feb1ad2534be Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Thu, 26 Mar 2009 00:36:33 +0100 Subject: [PATCH] Re-bind keys previously bound to Action Bar 1 to the Vehicle Buttons when using the default UI, so the button on-click effects work properly. This feature does require that the keys you want to control the vehicle buttons (usually 1-6) are actually bound to Bar 1. It will however still work if they are not, as long as you have the bar bound to those keys set as possess bar. --- Bartender4.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Bartender4.lua b/Bartender4.lua index e82e2d4..adc28b4 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -174,6 +174,24 @@ function Bartender4:UpdateBlizzardVehicle() RegisterStateDriver(MainMenuBar, "visibility", "hide") RegisterStateDriver(ShapeshiftBarFrame, "visibility", "hide") RegisterStateDriver(PossessBarFrame, "visibility", "hide") + + if not self.vehicleController then + self.vehicleController = CreateFrame("Frame", nil, UIParent, "SecureHandlerStateTemplate") + self.vehicleController:SetAttribute("_onstate-vehicle", [[ + if newstate == "vehicle" then + for i=1,6 do + local button, vbutton = ("ACTIONBUTTON%d"):format(i), ("VehicleMenuBarActionButton%d"):format(i) + for k=1,select('#', GetBindingKey(button)) do + local key = select(k, GetBindingKey(button)) + self:SetBindingClick(true, key, vbutton) + end + end + else + self:ClearBindings() + end + ]]) + end + RegisterStateDriver(self.vehicleController, "vehicle", "[target=vehicle,exists,bonusbar:5]vehicle;novehicle") else MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERING_VEHICLE") MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERED_VEHICLE") @@ -188,6 +206,9 @@ function Bartender4:UpdateBlizzardVehicle() UnregisterStateDriver(MainMenuBar, "visibility") UnregisterStateDriver(ShapeshiftBarFrame, "visibility") UnregisterStateDriver(PossessBarFrame, "visibility") + if self.vehicleController then + UnregisterStateDriver(self.vehicleController, "vehicle") + end end end