While developing a small cross-platform game on C++, I got stuck with following issue: when players are playing with a USB gamepad without touching a keyboard or mouse, the comp
I'm using QTDBUS using that
QDBusConnection bus = QDBusConnection::sessionBus();
if(bus.isConnected())
{
QString services[MAX_SERVICES] = {
"org.freedesktop.ScreenSaver",
"org.gnome.SessionManager"
};
QString paths[MAX_SERVICES] = {
"/org/freedesktop/ScreenSaver",
"/org/gnome/SessionManager"
};
for(int i = 0; i < MAX_SERVICES ; i++)
{
QDBusInterface screenSaverInterface(
services[i], paths[i],services[i], bus, this);
if (!screenSaverInterface.isValid())
continue;
QDBusReply reply = screenSaverInterface.call(
"Inhibit", "YOUR_APP_NAME", "REASON");
if (reply.isValid())
{
cookieID = reply.value();
qDebug()<<"succesful"
} else {
QDBusError error =reply.error();
qDebug()<