SYNERGY-1088 Fix code smells
This commit is contained in:
parent
495e631ea7
commit
38a9014f26
2 changed files with 18 additions and 4 deletions
|
|
@ -36,12 +36,17 @@ bool sleepInhibitCall(bool state, ArchSystemUnix::InhibitScreenServices serviceI
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XWindowsPowerManager::XWindowsPowerManager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
XWindowsPowerManager::~XWindowsPowerManager()
|
XWindowsPowerManager::~XWindowsPowerManager()
|
||||||
{
|
{
|
||||||
enableSleep();
|
enableSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XWindowsPowerManager::disableSleep()
|
void XWindowsPowerManager::disableSleep() const
|
||||||
{
|
{
|
||||||
if (!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kScreenSaver) &&
|
if (!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kScreenSaver) &&
|
||||||
!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kSessionManager))
|
!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kSessionManager))
|
||||||
|
|
@ -50,7 +55,7 @@ void XWindowsPowerManager::disableSleep()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XWindowsPowerManager::enableSleep()
|
void XWindowsPowerManager::enableSleep() const
|
||||||
{
|
{
|
||||||
if (!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kScreenSaver) &&
|
if (!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kScreenSaver) &&
|
||||||
!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kSessionManager))
|
!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kSessionManager))
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,18 @@
|
||||||
class XWindowsPowerManager
|
class XWindowsPowerManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
XWindowsPowerManager();
|
||||||
~XWindowsPowerManager();
|
~XWindowsPowerManager();
|
||||||
void disableSleep();
|
|
||||||
void enableSleep();
|
/**
|
||||||
|
* @brief Prevent the system from sleep
|
||||||
|
*/
|
||||||
|
void disableSleep() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables automatical sleep
|
||||||
|
*/
|
||||||
|
void enableSleep() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XWINDOWSPOWERMANAGER_H
|
#endif // XWINDOWSPOWERMANAGER_H
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue