mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-01 16:34:55 +02:00
Qt: Toggle Screensaver
This commit is contained in:
parent
0dd52ca7ab
commit
adada16603
@ -338,6 +338,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
|||||||
if (Core::GetState() == Core::State::Paused)
|
if (Core::GetState() == Core::State::Paused)
|
||||||
{
|
{
|
||||||
Core::SetState(Core::State::Running);
|
Core::SetState(Core::State::Running);
|
||||||
|
EnableScreenSaver(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -345,6 +346,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
|||||||
if (selection)
|
if (selection)
|
||||||
{
|
{
|
||||||
StartGame(selection->GetFilePath(), savestate_path);
|
StartGame(selection->GetFilePath(), savestate_path);
|
||||||
|
EnableScreenSaver(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -352,6 +354,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
|||||||
if (!default_path.isEmpty() && QFile::exists(default_path))
|
if (!default_path.isEmpty() && QFile::exists(default_path))
|
||||||
{
|
{
|
||||||
StartGame(default_path, savestate_path);
|
StartGame(default_path, savestate_path);
|
||||||
|
EnableScreenSaver(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -364,6 +367,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
|
|||||||
void MainWindow::Pause()
|
void MainWindow::Pause()
|
||||||
{
|
{
|
||||||
Core::SetState(Core::State::Paused);
|
Core::SetState(Core::State::Paused);
|
||||||
|
EnableScreenSaver(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OnStopComplete()
|
void MainWindow::OnStopComplete()
|
||||||
@ -441,6 +445,7 @@ bool MainWindow::RequestStop()
|
|||||||
void MainWindow::ForceStop()
|
void MainWindow::ForceStop()
|
||||||
{
|
{
|
||||||
BootManager::Stop();
|
BootManager::Stop();
|
||||||
|
EnableScreenSaver(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Reset()
|
void MainWindow::Reset()
|
||||||
@ -801,6 +806,18 @@ void MainWindow::NetPlayQuit()
|
|||||||
Settings::Instance().ResetNetPlayServer();
|
Settings::Instance().ResetNetPlayServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::EnableScreenSaver(bool enable)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
|
UICommon::EnableScreenSaver(
|
||||||
|
static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
|
||||||
|
"display", windowHandle())),
|
||||||
|
winId(), enable);
|
||||||
|
#else
|
||||||
|
UICommon::EnableScreenSaver(enable);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::eventFilter(QObject* object, QEvent* event)
|
bool MainWindow::eventFilter(QObject* object, QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::Close)
|
if (event->type() == QEvent::Close)
|
||||||
|
@ -115,6 +115,8 @@ private:
|
|||||||
void OnStopRecording();
|
void OnStopRecording();
|
||||||
void OnExportRecording();
|
void OnExportRecording();
|
||||||
|
|
||||||
|
void EnableScreenSaver(bool enable);
|
||||||
|
|
||||||
void OnStopComplete();
|
void OnStopComplete();
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user