diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 0cbfec8767..a2c8a1d239 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -410,6 +410,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) int value; // Axis value or Hat value int type; // Button type + int KeyPressed = 0; int pressed = 0; bool Succeed = false; bool Stop = false; // Stop the timer @@ -426,8 +427,6 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) // Save the button Id GetButtonWaitingID = _GetId; GetButtonWaitingTimer = 0; - // Reset the key in case we happen to have an old one - g_Pressed = 0; // Start the timer #if wxUSE_TIMER @@ -446,7 +445,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) { InputCommon::GetButton( WiiMoteEmu::joyinfo[PadID].joy, PadID, WiiMoteEmu::joyinfo[PadID].NumButtons, WiiMoteEmu::joyinfo[PadID].NumAxes, WiiMoteEmu::joyinfo[PadID].NumHats, - g_Pressed, value, type, pressed, Succeed, Stop, + KeyPressed, value, type, pressed, Succeed, Stop, LeftRight, Axis, XInput, Button, Hat, NoTriggerFilter); } @@ -523,7 +522,7 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) } // If we got a bad button - if(g_Pressed == -1) + if(KeyPressed == -1) { // Update text SetButtonTextAll(_GetId, (char *)"PAD: -1"); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp index 79fcb7d2bb..1a855fc409 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp @@ -120,6 +120,8 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, m_UpdatePadTimer = new wxTimer(this, IDTM_UPDATE_PAD); // Reset values + g_Pressed = 0; + ClickedButton = NULL; GetButtonWaitingID = 0; GetButtonWaitingTimer = 0; @@ -130,11 +132,10 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, ControlsCreated = false; Page = 0; - ClickedButton = NULL; //g_Config.Load(); CreatePadGUIControls(); - SetBackgroundColour(m_Notebook->GetBackgroundColour()); + //SetBackgroundColour(m_Notebook->GetBackgroundColour()); // Set control values UpdateGUI(); @@ -195,10 +196,10 @@ void WiimotePadConfigDialog::OnKeyDown(wxKeyEvent& event) } } #elif defined(HAVE_X11) && HAVE_X11 - g_Pressed = InputCommon::wxCharCodeWXToX(g_Pressed); - InputCommon::XKeyToString(g_Pressed, keyStr); + int XKey = InputCommon::wxCharCodeWXToX(g_Pressed); + InputCommon::XKeyToString(XKey, keyStr); SetButtonText(ClickedButton->GetId(), keyStr); - SaveKeyboardMapping(Page, ClickedButton->GetId(), g_Pressed); + SaveKeyboardMapping(Page, ClickedButton->GetId(), XKey); #endif } m_ButtonMappingTimer->Stop(); @@ -211,13 +212,13 @@ void WiimotePadConfigDialog::OnKeyDown(wxKeyEvent& event) // Input button clicked void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event) { - //DEBUG_LOG(WIIMOTE, "OnButtonClick: %i", g_Pressed); - - if (m_ButtonMappingTimer->IsRunning()) return; + event.Skip(); // Don't allow space to start a new Press Key option, that will interfer with setting a key to space if (g_Pressed == WXK_SPACE) { g_Pressed = 0; return; } + if (m_ButtonMappingTimer->IsRunning()) return; + // Create the button object ClickedButton = (wxButton *)event.GetEventObject(); // Save old label so we can revert back diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h index c84386ec63..ecc4a5dd94 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h @@ -75,7 +75,7 @@ class WiimotePadConfigDialog : public wxDialog DECLARE_EVENT_TABLE(); bool ControlsCreated; - int Page, g_Pressed, BoxW, BoxH; + int Page, BoxW, BoxH; wxString OldLabel; @@ -300,7 +300,7 @@ class WiimotePadConfigDialog : public wxDialog void OnButtonClick(wxCommandEvent& event); // Configure buttons - int GetButtonWaitingID, GetButtonWaitingTimer; + int GetButtonWaitingID, GetButtonWaitingTimer, g_Pressed; wxString GetButtonText(int id, int Page = -1); }; extern WiimotePadConfigDialog *m_PadConfigFrame;