mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
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:
@ -753,24 +753,15 @@ void CFrame::OnRenderWindowSizeRequest(int width, int height)
|
|||||||
|
|
||||||
bool CFrame::RendererHasFocus()
|
bool CFrame::RendererHasFocus()
|
||||||
{
|
{
|
||||||
if (m_RenderParent == nullptr)
|
// RendererHasFocus should return true any time any one of our
|
||||||
return false;
|
// windows has the focus, including any dialogs or other windows.
|
||||||
#ifdef _WIN32
|
//
|
||||||
if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
|
// wxGetActiveWindow() returns the current wxWindow which has
|
||||||
return true;
|
// focus. If it's not one of our windows, then it will return
|
||||||
#else
|
// null.
|
||||||
wxWindow *window = wxWindow::FindFocus();
|
|
||||||
if (window == nullptr)
|
wxWindow *focusWindow = wxGetActiveWindow();
|
||||||
return false;
|
return (focusWindow != nullptr);
|
||||||
// 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))
|
||||||
|
Reference in New Issue
Block a user