In linux only read keyboard and mouse input when the emulator window has focus.

Also other code clean up.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5053 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-02-13 23:56:24 +00:00
parent 5e6eecf0af
commit e5afde67ce
11 changed files with 56 additions and 28 deletions

View File

@ -595,7 +595,18 @@ void UpdatePadState(CONTROLLER_MAPPING_GC &_GCiMapping)
Tr = InputCommon::Pad_Convert(Tr);
}
}
#if defined(HAVE_X11) && HAVE_X11
bool HaveFocus (void)
{
Window GLWin = *(Window *)g_PADInitialize->pXWindow;
Window FocusWin;
int Revert;
XGetInputFocus(GCdisplay, &FocusWin, &Revert);
return (GLWin != 0 && GLWin == FocusWin);
}
#endif
// Multi System Input Status Check
bool IsKey(int Key)
{
@ -609,7 +620,7 @@ bool IsKey(int Key)
}
else if (MapKey < 0x1100)
#elif defined HAVE_X11 && HAVE_X11
if (MapKey < 256 || MapKey > 0xf000)
if (HaveFocus() && (MapKey < 256 || MapKey > 0xf000))
{
char keys[32];
KeyCode keyCode;