Skip to content

Commit ccda142

Browse files
authored
AceGUI-3.0: Keybinding: Add gamepad support
Gamepad bindings are completely in line with the rest of the keybinding system in WoW, so all that's really necessary to make them work in AceGUI is to add a handler to catch bindings.
1 parent 08c57ea commit ccda142

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Keybinding Widget
33
Set Keybindings in the Config UI.
44
-------------------------------------------------------------------------------]]
5-
local Type, Version = "Keybinding", 26
5+
local Type, Version = "Keybinding", 27
66
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
77
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
88

@@ -31,12 +31,14 @@ local function Keybinding_OnClick(frame, button)
3131
if self.waitingForKey then
3232
frame:EnableKeyboard(false)
3333
frame:EnableMouseWheel(false)
34+
frame:EnableGamePadButton(false)
3435
self.msgframe:Hide()
3536
frame:UnlockHighlight()
3637
self.waitingForKey = nil
3738
else
3839
frame:EnableKeyboard(true)
3940
frame:EnableMouseWheel(true)
41+
frame:EnableGamePadButton(true)
4042
self.msgframe:Show()
4143
frame:LockHighlight()
4244
self.waitingForKey = true
@@ -72,6 +74,7 @@ local function Keybinding_OnKeyDown(frame, key)
7274

7375
frame:EnableKeyboard(false)
7476
frame:EnableMouseWheel(false)
77+
frame:EnableGamePadButton(false)
7578
self.msgframe:Hide()
7679
frame:UnlockHighlight()
7780
self.waitingForKey = nil
@@ -119,6 +122,7 @@ local methods = {
119122
self:SetDisabled(false)
120123
self.button:EnableKeyboard(false)
121124
self.button:EnableMouseWheel(false)
125+
self.button:EnableGamePadButton(false)
122126
end,
123127

124128
-- ["OnRelease"] = nil,
@@ -195,10 +199,12 @@ local function Constructor()
195199
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
196200
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
197201
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
202+
button:SetScript("OnGamePadButtonDown", Keybinding_OnKeyDown)
198203
button:SetPoint("BOTTOMLEFT")
199204
button:SetPoint("BOTTOMRIGHT")
200205
button:SetHeight(24)
201206
button:EnableKeyboard(false)
207+
button:EnableGamePadButton(false)
202208

203209
local text = button:GetFontString()
204210
text:SetPoint("LEFT", 7, 0)

0 commit comments

Comments
 (0)