mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Frame: Remove callback function prototypes from header
Gets rid of more direct usages of the main_frame global, keeping the callbacks internal to the frame itself.
This commit is contained in:
@ -392,9 +392,7 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
|
||||
m_LogWindow->Disable();
|
||||
|
||||
InitializeTASDialogs();
|
||||
|
||||
State::SetOnAfterLoadCallback(OnAfterLoadCallback);
|
||||
Core::SetOnStoppedCallback(OnStoppedCallback);
|
||||
InitializeCoreCallbacks();
|
||||
|
||||
// Setup perspectives
|
||||
if (g_pCodeWindow)
|
||||
@ -515,6 +513,20 @@ void CFrame::InitializeTASDialogs()
|
||||
});
|
||||
}
|
||||
|
||||
void CFrame::InitializeCoreCallbacks()
|
||||
{
|
||||
// Warning: this gets called from the CPU thread, so we should
|
||||
// only queue things to do on the proper thread
|
||||
State::SetOnAfterLoadCallback([this] {
|
||||
AddPendingEvent(wxCommandEvent{wxEVT_HOST_COMMAND, IDM_UPDATE_GUI});
|
||||
});
|
||||
|
||||
// Warning: this gets called from the EmuThread
|
||||
Core::SetOnStoppedCallback([this] {
|
||||
AddPendingEvent(wxCommandEvent{wxEVT_HOST_COMMAND, IDM_STOPPED});
|
||||
});
|
||||
}
|
||||
|
||||
bool CFrame::RendererIsFullscreen()
|
||||
{
|
||||
bool fullscreen = false;
|
||||
@ -1025,28 +1037,6 @@ static int GetMenuIDFromHotkey(unsigned int key)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void OnAfterLoadCallback()
|
||||
{
|
||||
// warning: this gets called from the CPU thread, so we should only queue things to do on the
|
||||
// proper thread
|
||||
if (main_frame)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATE_GUI);
|
||||
main_frame->GetEventHandler()->AddPendingEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void OnStoppedCallback()
|
||||
{
|
||||
// warning: this gets called from the EmuThread, so we should only queue things to do on the
|
||||
// proper thread
|
||||
if (main_frame)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_STOPPED);
|
||||
main_frame->GetEventHandler()->AddPendingEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
// On OS X, we claim all keyboard events while
|
||||
|
Reference in New Issue
Block a user