Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
On windows, ignore WM_QUERYENDSESSION and close upon WM_ENDSESSION.
The messages can come through CFrame::MSWWindowProc and the wxApp implementation, so make sure to catch both.
Fixes issue 6546.
  • Loading branch information
shuffle2 committed Sep 10, 2013
1 parent 2d492bd commit 4841300
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Source/Core/DolphinWX/Src/Frame.cpp
Expand Up @@ -539,9 +539,24 @@ void CFrame::OnResize(wxSizeEvent& event)
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if (WM_SYSCOMMAND == nMsg && (SC_SCREENSAVE == wParam || SC_MONITORPOWER == wParam))
{
return 0;
}
else if (nMsg == WM_QUERYENDSESSION)
{
// Indicate that the application will be able to close
return 1;
}
else if (nMsg == WM_ENDSESSION)
{
// Actually trigger the close now
Close(true);
return 0;
}
else
{
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
}
#endif

Expand Down
11 changes: 11 additions & 0 deletions Source/Core/DolphinWX/Src/Main.cpp
Expand Up @@ -71,6 +71,8 @@ IMPLEMENT_APP(DolphinApp)

BEGIN_EVENT_TABLE(DolphinApp, wxApp)
EVT_TIMER(wxID_ANY, DolphinApp::AfterInit)
EVT_QUERY_END_SESSION(DolphinApp::OnEndSession)
EVT_END_SESSION(DolphinApp::OnEndSession)
END_EVENT_TABLE()

#include <wx/stdpaths.h>
Expand Down Expand Up @@ -433,6 +435,15 @@ void DolphinApp::InitLanguageSupport()
}
}

void DolphinApp::OnEndSession(wxCloseEvent& event)
{
// Close if we've recieved wxEVT_END_SESSION (ignore wxEVT_QUERY_END_SESSION)
if (!event.CanVeto())
{
main_frame->Close(true);
}
}

int DolphinApp::OnExit()
{
WiimoteReal::Shutdown();
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinWX/Src/Main.h
Expand Up @@ -33,6 +33,7 @@ class DolphinApp : public wxApp
wxLocale *m_locale;

void AfterInit(wxTimerEvent& WXUNUSED(event));
void OnEndSession(wxCloseEvent& event);
};

DECLARE_APP(DolphinApp);
Expand Down

0 comments on commit 4841300

Please sign in to comment.