From 387aba7a6c27232a164179d30366d7dfc57b0ba1 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 13 Apr 2010 20:02:48 +0000 Subject: [PATCH] Hopefully fixed "RendererHasFocus()" on windows. Input should work again. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5359 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Frame.cpp | 6 ++++-- Source/Core/DolphinWX/Src/Frame.h | 3 --- Source/Core/DolphinWX/Src/Main.cpp | 4 ---- .../Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp | 3 +-- .../Plugin_WiimoteNew/Src/WiimoteNew.cpp | 18 ++++-------------- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 266006a3bc..e251f5d002 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -757,8 +757,10 @@ bool CFrame::RendererHasFocus() #ifdef _WIN32 // Why doesn't the "else" method below work in windows when called from // Host_RendererHasFocus()? - bRendererHasFocus = m_RenderParent && (m_RenderParent == wxWindow::FindFocus()); - return bRendererHasFocus; + if (m_RenderParent) + if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow()) + return true; + return false; #else return m_RenderParent && (m_RenderParent == wxWindow::FindFocus()); #endif diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 14c09fb55e..307764a840 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -103,9 +103,6 @@ class CFrame : public wxFrame void DoPause(); void DoStop(); bool bRenderToMain; -#ifdef _WIN32 - bool bRendererHasFocus; -#endif bool bNoWiimoteMsg; void UpdateGUI(); void ToggleLogWindow(bool, int i = -1); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 54ecc3b530..2bb74210c1 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -677,9 +677,5 @@ void Host_SetWiiMoteConnectionState(int _State) bool Host_RendererHasFocus() { -#ifdef _WIN32 - return main_frame->bRendererHasFocus; -#else return main_frame->RendererHasFocus(); -#endif } diff --git a/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp b/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp index f8be2889db..81ab052c18 100644 --- a/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp +++ b/Source/Plugins/Plugin_GCPadNew/Src/GCPadNew.cpp @@ -1,5 +1,4 @@ -#include #include "Common.h" #include "pluginspecs_pad.h" @@ -28,7 +27,7 @@ #endif #endif -// the plugin +// plugin globals Plugin g_plugin( "GCPadNew", "Pad", "GCPad" ); SPADInitialize *g_PADInitialize = NULL; diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp index c49f4697dc..b6e0fcec2a 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp +++ b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteNew.cpp @@ -1,5 +1,4 @@ -#include #include "Common.h" #include "pluginspecs_wiimote.h" @@ -13,7 +12,6 @@ #if defined(HAVE_X11) && HAVE_X11 #include -Display* GCdisplay; #endif #define PLUGIN_VERSION 0x0100 @@ -29,6 +27,10 @@ Display* GCdisplay; #endif #endif +// plugin globals +Plugin g_plugin( "WiimoteNew", "Wiimote", "Wiimote" ); +SWiimoteInitialize g_WiimoteInitialize; + #ifdef _WIN32 class wxDLLApp : public wxApp { @@ -40,15 +42,6 @@ class wxDLLApp : public wxApp IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif -// copied from GCPad -SWiimoteInitialize g_WiimoteInitialize; -// Check if Dolphin is in focus -// ---------------- -bool IsFocus() -{ - // TODO: this - return true; -} // copied from GCPad HINSTANCE g_hInstance; @@ -70,9 +63,6 @@ wxWindow* GetParentedWxWindow(HWND Parent) #endif // / -// the plugin -Plugin g_plugin( "WiimoteNew", "Wiimote", "Wiimote" ); - #ifdef _WIN32 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) {