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:
parent
110fc18375
commit
01e11610a4
Source/Core/DolphinWX/Src
|
@ -200,13 +200,43 @@ CPanel::CPanel(
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
// event tables
|
||||||
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
|
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
|
||||||
// help button.
|
// help button.
|
||||||
|
|
||||||
const wxEventType wxEVT_HOST_COMMAND = wxNewEventType();
|
const wxEventType wxEVT_HOST_COMMAND = wxNewEventType();
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(CFrame, wxFrame)
|
BEGIN_EVENT_TABLE(CFrame, CRenderFrame)
|
||||||
|
|
||||||
// Menu bar
|
// Menu bar
|
||||||
EVT_MENU(wxID_OPEN, CFrame::OnOpen)
|
EVT_MENU(wxID_OPEN, CFrame::OnOpen)
|
||||||
|
@ -317,7 +347,7 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
bool _UseDebugger,
|
bool _UseDebugger,
|
||||||
bool ShowLogWindow,
|
bool ShowLogWindow,
|
||||||
long style)
|
long style)
|
||||||
: wxFrame(parent, id, title, pos, size, style)
|
: CRenderFrame(parent, id, title, pos, size, style)
|
||||||
, g_pCodeWindow(NULL)
|
, g_pCodeWindow(NULL)
|
||||||
, m_MenuBar(NULL)
|
, m_MenuBar(NULL)
|
||||||
, bRenderToMain(false), bNoWiimoteMsg(false)
|
, bRenderToMain(false), bNoWiimoteMsg(false)
|
||||||
|
|
|
@ -70,7 +70,24 @@ class CPanel : public wxPanel
|
||||||
#endif
|
#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:
|
public:
|
||||||
CFrame(wxFrame* parent,
|
CFrame(wxFrame* parent,
|
||||||
|
@ -206,7 +223,7 @@ class CFrame : public wxFrame
|
||||||
wxBoxSizer* sizerFrame;
|
wxBoxSizer* sizerFrame;
|
||||||
CGameListCtrl* m_GameListCtrl;
|
CGameListCtrl* m_GameListCtrl;
|
||||||
wxPanel* m_Panel;
|
wxPanel* m_Panel;
|
||||||
wxFrame* m_RenderFrame;
|
CRenderFrame* m_RenderFrame;
|
||||||
wxPanel* m_RenderParent;
|
wxPanel* m_RenderParent;
|
||||||
wxToolBarToolBase* m_ToolPlay;
|
wxToolBarToolBase* m_ToolPlay;
|
||||||
CLogWindow* m_LogWindow;
|
CLogWindow* m_LogWindow;
|
||||||
|
|
|
@ -736,7 +736,7 @@ void CFrame::StartGame(const std::string& filename)
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos);
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos);
|
||||||
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
|
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
|
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,
|
m_RenderFrame->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW,
|
||||||
wxCloseEventHandler(CFrame::OnRenderParentClose),
|
wxCloseEventHandler(CFrame::OnRenderParentClose),
|
||||||
(wxObject*)0, this);
|
(wxObject*)0, this);
|
||||||
|
|
Loading…
Reference in New Issue