summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/HotkeyDlg.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp
index 03b40dd286..5fe375c04f 100644
--- a/Source/Core/DolphinWX/HotkeyDlg.cpp
+++ b/Source/Core/DolphinWX/HotkeyDlg.cpp
@@ -72,6 +72,26 @@ void HotkeyConfigDialog::OnKeyDown(wxKeyEvent& event)
}
else
{
+ // Check if the hotkey combination was already applied to another button
+ // and unapply it if necessary.
+ for (wxButton* btn : m_Button_Hotkeys)
+ {
+ // We compare against this to see if we have a duplicate bind attempt.
+ wxString existingHotkey = btn->GetLabel();
+
+ wxString tentativeModKey = InputCommon::WXKeymodToString(g_Modkey);
+ wxString tentativePressedKey = InputCommon::WXKeyToString(g_Pressed);
+ wxString tentativeHotkey(tentativeModKey + tentativePressedKey);
+
+ // Found a button that already has this binding. Unbind it.
+ if (tentativeHotkey == existingHotkey)
+ {
+ SaveButtonMapping(btn->GetId(), -1, 0);
+ SetButtonText(btn->GetId(), wxString());
+ }
+ }
+
+ // Proceed to apply the binding to the selected button.
SetButtonText(ClickedButton->GetId(),
InputCommon::WXKeyToString(g_Pressed),
InputCommon::WXKeymodToString(g_Modkey));