mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Fix focus detection on OS X by replacing wxGetActiveWindow with wxWindow::FindFocus.
wxGetActiveWindow is implemented as "return NULL" on OS X, while wxWindow::FindFocus works. On Windows, the difference is in the use of GetActiveWindow() vs. GetForegroundWindow(). A MSDN comment says: > A system has only one active window, which GetForegroundWindow() > returns. GetActiveWindow() seems to return the same window as > GetForegroundWindow() if the foreground window belongs to the current > thread. Otherwise, it always returns null, rather than the topmost > window of the calling thread. Since we are on the GUI thread, it shouldn't make any difference.
This commit is contained in:
@ -708,7 +708,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||
wxString caption = event.GetString().BeforeFirst(':');
|
||||
wxString text = event.GetString().AfterFirst(':');
|
||||
bPanicResult = (wxYES == wxMessageBox(text,
|
||||
caption, event.GetInt() ? wxYES_NO : wxOK, wxGetActiveWindow()));
|
||||
caption, event.GetInt() ? wxYES_NO : wxOK, wxWindow::FindFocus()));
|
||||
panic_event.Set();
|
||||
}
|
||||
break;
|
||||
@ -805,11 +805,11 @@ bool CFrame::UIHasFocus()
|
||||
// UIHasFocus should return true any time any one of our UI
|
||||
// windows has the focus, including any dialogs or other windows.
|
||||
//
|
||||
// wxGetActiveWindow() returns the current wxWindow which has
|
||||
// wxWindow::FindFocus() returns the current wxWindow which has
|
||||
// focus. If it's not one of our windows, then it will return
|
||||
// null.
|
||||
|
||||
wxWindow *focusWindow = wxGetActiveWindow();
|
||||
wxWindow *focusWindow = wxWindow::FindFocus();
|
||||
return (focusWindow != nullptr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user