Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gamepad support to keybinding widget #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Keybinding Widget
Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 26
local Type, Version = "Keybinding", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end

Expand Down Expand Up @@ -31,12 +31,14 @@ local function Keybinding_OnClick(frame, button)
if self.waitingForKey then
frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
frame:EnableGamePadButton(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
else
frame:EnableKeyboard(true)
frame:EnableMouseWheel(true)
frame:EnableGamePadButton(true)
self.msgframe:Show()
frame:LockHighlight()
self.waitingForKey = true
Expand Down Expand Up @@ -72,6 +74,7 @@ local function Keybinding_OnKeyDown(frame, key)

frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
frame:EnableGamePadButton(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
Expand Down Expand Up @@ -119,6 +122,7 @@ local methods = {
self:SetDisabled(false)
self.button:EnableKeyboard(false)
self.button:EnableMouseWheel(false)
self.button:EnableGamePadButton(false)
end,

-- ["OnRelease"] = nil,
Expand Down Expand Up @@ -195,10 +199,12 @@ local function Constructor()
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
button:SetScript("OnGamePadButtonDown", Keybinding_OnKeyDown)
button:SetPoint("BOTTOMLEFT")
button:SetPoint("BOTTOMRIGHT")
button:SetHeight(24)
button:EnableKeyboard(false)
button:EnableGamePadButton(false)

local text = button:GetFontString()
text:SetPoint("LEFT", 7, 0)
Expand Down
Loading