Frame: Fix RendererHasFocus
The logic of RendererHasFocus was extremely convoluted beforehand and was too brittle and broke in certain circumstances, like when the GCPad window was active. Simplify it and leave a comment explaining the new logic. This fixes the GCPad window not working when Background Input is unchecked.
This commit is contained in:
parent
e4eec2002b
commit
ff918df889
|
@ -753,24 +753,15 @@ void CFrame::OnRenderWindowSizeRequest(int width, int height)
|
|||
|
||||
bool CFrame::RendererHasFocus()
|
||||
{
|
||||
if (m_RenderParent == nullptr)
|
||||
return false;
|
||||
#ifdef _WIN32
|
||||
if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
|
||||
return true;
|
||||
#else
|
||||
wxWindow *window = wxWindow::FindFocus();
|
||||
if (window == 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;
|
||||
// RendererHasFocus should return true any time any one of our
|
||||
// windows has the focus, including any dialogs or other windows.
|
||||
//
|
||||
// wxGetActiveWindow() returns the current wxWindow which has
|
||||
// focus. If it's not one of our windows, then it will return
|
||||
// null.
|
||||
|
||||
wxWindow *focusWindow = wxGetActiveWindow();
|
||||
return (focusWindow != nullptr);
|
||||
}
|
||||
|
||||
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
||||
|
|
Loading…
Reference in New Issue