From fcb951c0c944c8baba343feaf1df762916309889 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Tue, 3 Feb 2009 10:17:01 +0000 Subject: [PATCH] nJoy: Made the out of focus option only apply to gamepad input. As I understand it it's primarily used to allow keyboard input at the same time as Dolphin is used. Then it would probably be annoying to send the keyboard input to Dolphin while you are typing. Keyboard inputs was also the main idea with the out of focus option, I think that it's not as important for gamepad input as you are less likely to use the gamepad in two different programs simultaneously. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2087 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp | 4 ++-- Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp | 8 +++++--- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp | 7 +++---- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp index bfe22f2f01..0ffd4258e4 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/Config.cpp @@ -164,7 +164,7 @@ void Config::Save(int Slot) file.Set(SectionName.c_str(), "Diagonal", PadMapping[i].SDiagonal); file.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle); - file.Set(SectionName.c_str(), "CheckForFocus", bCheckFocus); + file.Set(SectionName.c_str(), "CheckForFocus", g_Config.bCheckFocus); // ====================================== // Debugging @@ -247,7 +247,7 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID) file.Get(SectionName.c_str(), "Diagonal", &PadMapping[i].SDiagonal, "100%"); file.Get(SectionName.c_str(), "SquareToCircle", &Tmp, false); PadMapping[i].bSquareToCircle = Tmp; - file.Get(SectionName.c_str(), "CheckForFocus", &bCheckFocus, true); + file.Get(SectionName.c_str(), "CheckForFocus", &g_Config.bCheckFocus, false); // ============================= // Debugging diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp index e80994deb0..8a742bf6b6 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp @@ -417,10 +417,10 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event ) SizeWindow(); break; case IDC_CHECKFOCUS: - bCheckFocus = m_CBCheckFocus[notebookpage]->IsChecked(); + g_Config.bCheckFocus = m_CBCheckFocus[notebookpage]->IsChecked(); for(int i = 0; i < 4; i++) { - m_CBCheckFocus[i]->SetValue(bCheckFocus); + m_CBCheckFocus[i]->SetValue(g_Config.bCheckFocus); } break; case IDC_CONTROLTYPE: @@ -804,7 +804,7 @@ void ConfigBox::CreateGUIControls() m_gGenSettingsID[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Settings") ); m_CBSaveByID[i] = new wxCheckBox(m_Controller[i], IDC_SAVEBYID, wxT("Save by ID"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_CBShowAdvanced[i] = new wxCheckBox(m_Controller[i], IDC_SHOWADVANCED, wxT("Show advanced settings"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_CBCheckFocus[i] = new wxCheckBox(m_Controller[i], IDC_CHECKFOCUS, wxT("Only accept input when Dolphin is in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_CBCheckFocus[i] = new wxCheckBox(m_Controller[i], IDC_CHECKFOCUS, wxT("Allow out of focus input"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); // Populate general settings 3 m_gGenSettingsID[i]->Add(m_CBSaveByID[i], 0, wxEXPAND | wxALL, 3); @@ -824,6 +824,8 @@ void ConfigBox::CreateGUIControls() "\nto save your settings if you have multiple controllers.") , i+1 )); + m_CBCheckFocus[i]->SetToolTip(wxT( + "Allow Gamepad input even when Dolphin is not in focus. Out of focus keyboard input is never allowed.")); // Populate settings m_sSettings[i] = new wxBoxSizer ( wxHORIZONTAL ); diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 0f3a274d81..138af96124 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -89,7 +89,6 @@ CONTROLLER_STATE PadState[4]; CONTROLLER_MAPPING PadMapping[4]; bool emulator_running = false; int NumPads = 0, NumGoodPads = 0; -bool bCheckFocus = true; HWND m_hWnd; // Handle to window SPADInitialize *g_PADInitialize = NULL; @@ -396,12 +395,12 @@ void Shutdown() } -// Set buttons status from wxWidgets in the main application +// Set buttons status from keyboard input. Currently this is done from wxWidgets in the main application. // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void PAD_Input(u16 _Key, u8 _UpDown) { // Check that Dolphin is in focus, otherwise don't update the pad status - if (bCheckFocus && !IsFocus()) return; + if (!IsFocus()) return; // Check if the keys are interesting, and then update it for(int i = 0; i < 4; i++) @@ -785,7 +784,7 @@ void ReadButton(int controller, int button) void GetJoyState(int controller) { // Check that Dolphin is in focus, otherwise don't update the pad status - if (bCheckFocus && !IsFocus()) return; + if (!g_Config.bCheckFocus && !IsFocus()) return; // Update the gamepad status SDL_JoystickUpdate(); diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h index 00b5a7b894..9295304e7e 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.h @@ -232,7 +232,6 @@ extern std::vector Keys; extern CONTROLLER_MAPPING PadMapping[4]; extern HWND m_hWnd; // Handle to window extern int NumPads, NumGoodPads; // Number of goods pads - extern bool bCheckFocus; #endif