mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
Move UiHasFocus into DolphinApp
Using a wxEVT_ACTIVATE_APP event.
This commit is contained in:
parent
2005b4430f
commit
ee201455a8
@ -504,10 +504,10 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
// Events
|
||||
void CFrame::OnActive(wxActivateEvent& event)
|
||||
{
|
||||
m_bHasFocus = (event.GetActive() && event.GetEventObject() == m_RenderFrame);
|
||||
m_bRendererHasFocus = (event.GetActive() && event.GetEventObject() == m_RenderFrame);
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
{
|
||||
if (m_bHasFocus)
|
||||
if (m_bRendererHasFocus)
|
||||
{
|
||||
if (SConfig::GetInstance().bRenderToMain)
|
||||
m_RenderParent->SetFocus();
|
||||
@ -779,20 +779,6 @@ bool CFrame::RendererHasFocus()
|
||||
return m_bRendererHasFocus;
|
||||
}
|
||||
|
||||
// Returns true any time any one of our UI windows
|
||||
// has the focus, including any dialogs or other windows.
|
||||
bool CFrame::UIHasFocus()
|
||||
{
|
||||
// UIHasFocus should return true any time any one of our UI
|
||||
// windows has the focus, including any dialogs or other windows.
|
||||
//
|
||||
// wxWindow::FindFocus() returns the current wxWindow which has
|
||||
// focus. If it's not one of our windows, then it will return
|
||||
// null.
|
||||
|
||||
return m_bHasFocus;
|
||||
}
|
||||
|
||||
void CFrame::OnGameListCtrlItemActivated(wxListEvent& WXUNUSED(event))
|
||||
{
|
||||
// Show all platforms and regions if...
|
||||
|
@ -101,7 +101,6 @@ public:
|
||||
void OnRenderParentClose(wxCloseEvent& event);
|
||||
void OnRenderParentMove(wxMoveEvent& event);
|
||||
bool RendererHasFocus();
|
||||
bool UIHasFocus();
|
||||
bool RendererIsFullscreen();
|
||||
void DoFullscreen(bool bF);
|
||||
void ToggleDisplayMode(bool bFullscreen);
|
||||
@ -158,7 +157,7 @@ private:
|
||||
bool m_bNoDocking = false;
|
||||
bool m_bGameLoading = false;
|
||||
bool m_bClosing = false;
|
||||
bool m_bHasFocus = false;
|
||||
bool m_bRendererHasFocus = false;
|
||||
bool m_confirmStop = false;
|
||||
bool m_tried_graceful_shutdown = false;
|
||||
int m_saveSlot = 1;
|
||||
|
@ -84,6 +84,7 @@ bool DolphinApp::OnInit()
|
||||
Bind(wxEVT_QUERY_END_SESSION, &DolphinApp::OnEndSession, this);
|
||||
Bind(wxEVT_END_SESSION, &DolphinApp::OnEndSession, this);
|
||||
Bind(wxEVT_IDLE, &DolphinApp::OnIdle, this);
|
||||
Bind(wxEVT_ACTIVATE_APP, &DolphinApp::OnActivate, this);
|
||||
|
||||
// Register message box and translation handlers
|
||||
RegisterMsgAlertHandler(&wxMsgAlert);
|
||||
@ -256,6 +257,11 @@ void DolphinApp::AfterInit()
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinApp::OnActivate(wxActivateEvent& ev)
|
||||
{
|
||||
m_is_active = ev.GetActive();
|
||||
}
|
||||
|
||||
void DolphinApp::InitLanguageSupport()
|
||||
{
|
||||
std::string language_code;
|
||||
@ -500,7 +506,7 @@ void Host_SetWiiMoteConnectionState(int _State)
|
||||
|
||||
bool Host_UIHasFocus()
|
||||
{
|
||||
return main_frame->UIHasFocus();
|
||||
return wxGetApp().IsActiveThreadsafe();
|
||||
}
|
||||
|
||||
bool Host_RendererHasFocus()
|
||||
|
@ -16,6 +16,7 @@ extern CFrame* main_frame;
|
||||
class DolphinApp : public wxApp
|
||||
{
|
||||
public:
|
||||
bool IsActiveThreadsafe() const { return m_is_active; }
|
||||
CFrame* GetCFrame();
|
||||
|
||||
private:
|
||||
@ -33,10 +34,12 @@ private:
|
||||
void OnEndSession(wxCloseEvent& event);
|
||||
void InitLanguageSupport();
|
||||
void AfterInit();
|
||||
void OnActivate(wxActivateEvent& ev);
|
||||
void OnIdle(wxIdleEvent&);
|
||||
|
||||
bool m_batch_mode = false;
|
||||
bool m_confirm_stop = false;
|
||||
bool m_is_active = true;
|
||||
bool m_load_file = false;
|
||||
bool m_play_movie = false;
|
||||
bool m_use_debugger = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user