Revert "Frame: Fix RendererHasFocus"

This reverts commit ff918df88991710d58d983aa2e5dbcf03f2064ab.

This changed it from "RendererHasFocus" to "UIHasFocus", which is
wrong. Specifically, it broke for non-Render to Main Window cases where
the renderer window isn't managed by wx. It also broke the pending
exclusive fullscreen support, which checks this function to determine if
the renderer is on top so it can full-screen it.

We'll add a new hook, "UIHasFocus", in the next commit.
This commit is contained in:
Jasper St. Pierre 2014-07-16 10:21:22 -04:00
parent 6937f7cbde
commit ee087f5953

View File

@ -753,15 +753,24 @@ void CFrame::OnRenderWindowSizeRequest(int width, int height)
bool CFrame::RendererHasFocus() bool CFrame::RendererHasFocus()
{ {
// RendererHasFocus should return true any time any one of our if (m_RenderParent == nullptr)
// windows has the focus, including any dialogs or other windows. return false;
// #ifdef _WIN32
// wxGetActiveWindow() returns the current wxWindow which has if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
// focus. If it's not one of our windows, then it will return return true;
// null. #else
wxWindow *window = wxWindow::FindFocus();
wxWindow *focusWindow = wxGetActiveWindow(); if (window == nullptr)
return (focusWindow != nullptr); return false;
// Why these different cases?
if (m_RenderParent == window ||
m_RenderParent == window->GetParent() ||
m_RenderParent->GetParent() == window->GetParent())
{
return true;
}
#endif
return false;
} }
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event)) void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))