PadSimple: Don't allow input when Dolphin is not in focus supports the rendering to main window option to
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2058 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d352372ccf
commit
4837dac8b6
|
@ -60,6 +60,10 @@ SPADInitialize g_PADInitialize;
|
|||
SPADStatus recordBuffer[RECORD_SIZE];
|
||||
int count = 0;
|
||||
|
||||
//******************************************************************************
|
||||
// Supporting functions
|
||||
//******************************************************************************
|
||||
|
||||
void RecordInput(const SPADStatus& _rPADStatus)
|
||||
{
|
||||
if (count >= RECORD_SIZE)
|
||||
|
@ -102,6 +106,18 @@ void SaveRecord()
|
|||
}
|
||||
}
|
||||
|
||||
// Check if Dolphin is in focus
|
||||
bool IsFocus()
|
||||
{
|
||||
HWND Parent = GetParent(g_PADInitialize.hWnd);
|
||||
HWND TopLevel = GetParent(Parent);
|
||||
// Support both rendering to main window and not
|
||||
if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == g_PADInitialize.hWnd)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
@ -147,6 +163,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
|||
#endif
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
// Plugin specification functions
|
||||
//******************************************************************************
|
||||
|
||||
|
||||
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
|
@ -618,8 +639,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
|||
// TODO fix g_PADInitialize.hWnd != DolphinWX frame
|
||||
if (pad[_numPAD].bDisable)
|
||||
{
|
||||
if (g_PADInitialize.hWnd != GetForegroundWindow())
|
||||
return;
|
||||
if (!IsFocus()) return;
|
||||
}
|
||||
// Dolphin doesn't really care about the pad error codes anyways...
|
||||
_pPADStatus->err = PAD_ERR_NONE;
|
||||
|
@ -689,6 +709,9 @@ unsigned int PAD_GetAttachedPads()
|
|||
return connected;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
// Load and save the configuration
|
||||
//******************************************************************************
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
|
|
|
@ -86,5 +86,6 @@ extern SPads pad[];
|
|||
|
||||
void LoadConfig();
|
||||
void SaveConfig();
|
||||
bool IsFocus();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue