Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: add org.mate.ScreenSaver as fallback #11034

Merged
merged 1 commit into from Oct 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 29 additions & 8 deletions rpcs3/display_sleep_control.cpp
Expand Up @@ -23,8 +23,15 @@ bool display_sleep_control_supported()
#if defined(_WIN32) || defined(__APPLE__)
return true;
#elif defined(HAVE_QTDBUS)
QDBusInterface interface("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", QDBusConnection::sessionBus());
return interface.isValid();
for (const QString& service : { "org.freedesktop.ScreenSaver", "org.mate.ScreenSaver" })
{
QDBusInterface interface(service, "/ScreenSaver", service, QDBusConnection::sessionBus());
if (interface.isValid())
{
return true;
}
}
return false;
#else
return false;
#endif
Expand All @@ -48,8 +55,15 @@ void enable_display_sleep()
#elif defined(HAVE_QTDBUS)
if (s_dbus_cookie != 0)
{
QDBusInterface interface("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", QDBusConnection::sessionBus());
interface.call("UnInhibit", s_dbus_cookie);
for (const QString& service : { "org.freedesktop.ScreenSaver", "org.mate.ScreenSaver" })
{
QDBusInterface interface(service, "/ScreenSaver", service, QDBusConnection::sessionBus());
if (interface.isValid())
{
interface.call("UnInhibit", s_dbus_cookie);
break;
}
}
s_dbus_cookie = 0;
}
#endif
Expand All @@ -67,11 +81,18 @@ void disable_display_sleep()
#elif defined(__APPLE__)
IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, kIOPMAssertionLevelOn, CFSTR("Game running"), &s_pm_assertion);
#elif defined(HAVE_QTDBUS)
QDBusInterface interface("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", QDBusConnection::sessionBus());
QDBusReply<u32> reply = interface.call("Inhibit", "rpcs3", "Game running");
if (reply.isValid())
for (const QString& service : { "org.freedesktop.ScreenSaver", "org.mate.ScreenSaver" })
{
s_dbus_cookie = reply.value();
QDBusInterface interface(service, "/ScreenSaver", service, QDBusConnection::sessionBus());
if (interface.isValid())
{
QDBusReply<u32> reply = interface.call("Inhibit", "rpcs3", "Game running");
if (reply.isValid())
{
s_dbus_cookie = reply.value();
}
break;
}
}
#endif
}