Make sure screensaver does not start while a game is running in MS Windows

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5371 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-04-15 03:25:35 +00:00
parent 110fc18375
commit 01e11610a4
3 changed files with 52 additions and 5 deletions

View File

@ -200,13 +200,43 @@ CPanel::CPanel(
}
#endif
CRenderFrame::CRenderFrame(wxFrame* parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, long style)
: wxFrame(parent, id, title, pos, size, style)
{
}
#ifdef _WIN32
WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
switch (nMsg)
{
case WM_SYSCOMMAND:
switch (wParam)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
if (Core::GetState() == Core::CORE_RUN)
break;
default:
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
break;
default:
// By default let wxWidgets do what it normally does with this event
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
return 0;
}
#endif
// event tables
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
// help button.
const wxEventType wxEVT_HOST_COMMAND = wxNewEventType();
BEGIN_EVENT_TABLE(CFrame, wxFrame)
BEGIN_EVENT_TABLE(CFrame, CRenderFrame)
// Menu bar
EVT_MENU(wxID_OPEN, CFrame::OnOpen)
@ -317,7 +347,7 @@ CFrame::CFrame(wxFrame* parent,
bool _UseDebugger,
bool ShowLogWindow,
long style)
: wxFrame(parent, id, title, pos, size, style)
: CRenderFrame(parent, id, title, pos, size, style)
, g_pCodeWindow(NULL)
, m_MenuBar(NULL)
, bRenderToMain(false), bNoWiimoteMsg(false)

View File

@ -70,7 +70,24 @@ class CPanel : public wxPanel
#endif
};
class CFrame : public wxFrame
class CRenderFrame : public wxFrame
{
public:
CRenderFrame(wxFrame* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Dolphin"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
private:
#ifdef _WIN32
// Receive WndProc messages
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
#endif
};
class CFrame : public CRenderFrame
{
public:
CFrame(wxFrame* parent,
@ -206,7 +223,7 @@ class CFrame : public wxFrame
wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
wxFrame* m_RenderFrame;
CRenderFrame* m_RenderFrame;
wxPanel* m_RenderParent;
wxToolBarToolBase* m_ToolPlay;
CLogWindow* m_LogWindow;

View File

@ -736,7 +736,7 @@ void CFrame::StartGame(const std::string& filename)
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos);
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
m_RenderFrame = new wxFrame((wxWindow *)NULL, wxID_ANY, _("Dolphin"), position, size);
m_RenderFrame = new CRenderFrame((wxFrame*)this, wxID_ANY, _("Dolphin"), position, size);
m_RenderFrame->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW,
wxCloseEventHandler(CFrame::OnRenderParentClose),
(wxObject*)0, this);