From 2be444965a4c03ca29e0219ed98f40a5068af724 Mon Sep 17 00:00:00 2001 From: Soren Jorvang Date: Sat, 26 Jun 2010 13:07:33 +0000 Subject: [PATCH] When checking to see if the rendering window has focus, there are a few different variations that can be true depending on circumstances. This would likely cover the _WIN32 case as well, but since I don't pretend to fully understand just what is going on with wxWidgets here, I can't really call this any less of a hack.. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5794 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Frame.cpp | 17 ++++++++++------- Source/Plugins/Plugin_Wiimote/Src/main.cpp | 3 --- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 582e40640b..1b534d0e66 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -740,16 +740,19 @@ void CFrame::OnSizeRequest(int& x, int& y, int& width, int& height) bool CFrame::RendererHasFocus() { + if (m_RenderParent == NULL || wxWindow::FindFocus() == NULL) + return false; #ifdef _WIN32 - // Why doesn't the "else" method below work in windows when called from - // Host_RendererHasFocus()? - if (m_RenderParent) - if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow()) - return true; - return false; + if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow()) + return true; #else - return m_RenderParent && (m_RenderParent == wxWindow::FindFocus()); + // Why these different cases? + if (m_RenderParent == wxWindow::FindFocus() || + m_RenderParent == wxWindow::FindFocus()->GetParent() || + m_RenderParent->GetParent() == wxWindow::FindFocus()->GetParent()) + return true; #endif + return false; } void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event)) diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index f0430bf4c0..0807219654 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -411,9 +411,6 @@ unsigned int Wiimote_UnPairWiimotes() bool IsFocus() { -#if defined(__APPLE__) && defined(USE_WX) && USE_WX - return true; /* XXX */ -#endif return g_WiimoteInitialize.pRendererHasFocus(); }