Get GCPadNew keyboard working in linux. Also some code cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5320 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-04-10 20:44:56 +00:00
parent d00f5b20a1
commit a5edf59787
7 changed files with 128 additions and 93 deletions

View File

@ -56,12 +56,14 @@ bool IsFocus()
#elif defined HAVE_X11 && HAVE_X11
Display* GCdisplay = (Display*)g_PADInitialize->hWnd;
Window GLWin = *(Window *)g_PADInitialize->pXWindow;
bool bFocus = False;
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
bFocus = (wxPanel *)g_PADInitialize->pPanel == wxWindow::FindFocus();
#endif
Window FocusWin;
int Revert;
XGetInputFocus(GCdisplay, &FocusWin, &Revert);
XWindowAttributes WinAttribs;
XGetWindowAttributes (GCdisplay, GLWin, &WinAttribs);
return (GLWin != 0 && (GLWin == FocusWin || WinAttribs.override_redirect));
return (GLWin == FocusWin || bFocus);
#else
return true;
#endif
@ -181,8 +183,10 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
// if we want background input or have focus
if ( g_plugin.controllers[_numPAD]->options[0].settings[0]->value || IsFocus() )
{
// get input
((GCPad*)g_plugin.controllers[ _numPAD ])->GetInput( _pPADStatus );
}
else
{
// center sticks
@ -256,10 +260,20 @@ void GetDllInfo(PLUGIN_INFO* _pPluginInfo)
void DllConfig(HWND _hParent)
{
bool was_init = false;
#if defined(HAVE_X11) && HAVE_X11
Display *dpy = NULL;
#endif
if ( g_plugin.controller_interface.IsInit() ) // hack for showing dialog when game isnt running
was_init = true;
else
InitPlugin( _hParent );
{
#if defined(HAVE_X11) && HAVE_X11
dpy = XOpenDisplay(0);
InitPlugin(dpy);
#else
InitPlugin(_hParent);
#endif
}
// copied from GCPad
#if defined(HAVE_WX) && HAVE_WX
@ -286,8 +300,13 @@ void DllConfig(HWND _hParent)
#endif
// /
if ( false == was_init ) // hack for showing dialog when game isnt running
if ( !was_init ) // hack for showing dialog when game isnt running
{
#if defined(HAVE_X11) && HAVE_X11
XCloseDisplay(dpy);
#endif
g_plugin.controller_interface.DeInit();
}
}
// ___________________________________________________________________________