diff --git a/Source/Plugins/Plugin_GCPad/Src/GCPad.cpp b/Source/Plugins/Plugin_GCPad/Src/GCPad.cpp index e515a22727..19843ff632 100644 --- a/Source/Plugins/Plugin_GCPad/Src/GCPad.cpp +++ b/Source/Plugins/Plugin_GCPad/Src/GCPad.cpp @@ -598,17 +598,6 @@ void UpdatePadState(CONTROLLER_MAPPING_GC &_GCiMapping) } } -#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) { @@ -622,7 +611,7 @@ bool IsKey(int Key) } else if (MapKey < 0x1100) #elif defined HAVE_X11 && HAVE_X11 - if (HaveFocus() && (MapKey < 256 || MapKey > 0xf000)) + if (MapKey < 256 || MapKey > 0xf000) { char keys[32]; KeyCode keyCode; @@ -663,7 +652,13 @@ bool IsFocus() return true; else return false; -#else +#elif defined HAVE_X11 && HAVE_X11 + Window GLWin = *(Window *)g_PADInitialize->pXWindow; + Window FocusWin; + int Revert; + XGetInputFocus(GCdisplay, &FocusWin, &Revert); + return (GLWin != 0 && GLWin == FocusWin); +#else return true; -#endif +#endif } diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 0586cfe285..24e1f25dfd 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -196,17 +196,6 @@ void LoadRecordedMovements() } } -#if defined(HAVE_X11) && HAVE_X11 -bool HaveFocus (void) -{ - Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow; - Window FocusWin; - int Revert; - XGetInputFocus(WMdisplay, &FocusWin, &Revert); - return (GLWin != 0 && GLWin == FocusWin); -} -#endif - /* Calibrate the mouse position to the emulation window. g_WiimoteInitialize.hWnd is the rendering window handle. */ void GetMousePos(float& x, float& y) { @@ -231,7 +220,7 @@ void GetMousePos(float& x, float& y) float WinWidth = 0, WinHeight = 0; float XOffset = 0, YOffset = 0; int root_x, root_y, win_x, win_y; - if (HaveFocus()) + if (IsFocus()) { Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow; XWindowAttributes WinAttribs; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h index 5c37d9ae37..3291db1c9e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h @@ -44,10 +44,6 @@ void Update(int _number); void DoState(PointerWrap &p); bool IsKey(int Key); -#if defined(HAVE_X11) && HAVE_X11 -bool HaveFocus (void); -#endif - // Recordings void LoadRecordedMovements(); void GetMousePos(float& x, float& y); diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index 303748083a..ff7774f665 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -310,7 +310,7 @@ bool IsKey(int Key) } else if (MapKey < 0x1100) #elif defined(HAVE_X11) && HAVE_X11 - if (HaveFocus() && (MapKey < 256 || MapKey >= 0xf000)) + if (MapKey < 256 || MapKey >= 0xf000) { char keys[32]; KeyCode keyCode; @@ -346,7 +346,7 @@ bool IsKey(int Key) } #endif #if defined(HAVE_X11) && HAVE_X11 - if ((Key == EWM_SHAKE || Key == EWM_A || Key == EWM_B) && HaveFocus()) + if (Key == EWM_SHAKE || Key == EWM_A || Key == EWM_B) { Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow; int root_x, root_y, win_x, win_y; diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 67f503966a..2e84dd9c54 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -411,6 +411,12 @@ bool IsFocus() return true; else return false; +#elif defined HAVE_X11 && HAVE_X11 + Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow; + Window FocusWin; + int Revert; + XGetInputFocus(WMdisplay, &FocusWin, &Revert); + return (GLWin != 0 && GLWin == FocusWin); #else return true; #endif