mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-24 19:42:24 +03:00
now disabling disable job timer when forcing screen saver
activation. previously the timer would deactivate the screen saver shortly after activation. job timer is restored when the screen saver is deactivated.
This commit is contained in:
parent
a5391a0a1d
commit
7100e07d2b
@ -20,7 +20,8 @@ CXWindowsScreenSaver::CXWindowsScreenSaver(
|
||||
m_display(display),
|
||||
m_notify(None),
|
||||
m_xscreensaver(None),
|
||||
m_xscreensaverActive(false)
|
||||
m_xscreensaverActive(false),
|
||||
m_disabled(false)
|
||||
{
|
||||
// screen saver disable callback
|
||||
m_disableJob = new TMethodJob<CXWindowsScreenSaver>(this,
|
||||
@ -165,8 +166,8 @@ CXWindowsScreenSaver::setNotify(Window notify)
|
||||
void
|
||||
CXWindowsScreenSaver::enable()
|
||||
{
|
||||
log((CLOG_INFO "enable screensaver"));
|
||||
// for xscreensaver
|
||||
m_disabled = false;
|
||||
m_screen->removeTimer(m_disableJob);
|
||||
|
||||
// for built-in X screen saver
|
||||
@ -177,9 +178,9 @@ log((CLOG_INFO "enable screensaver"));
|
||||
void
|
||||
CXWindowsScreenSaver::disable()
|
||||
{
|
||||
log((CLOG_INFO "disable screensaver"));
|
||||
// for xscreensaver. 5 seconds should be plenty often to
|
||||
// suppress the screen saver.
|
||||
m_disabled = true;
|
||||
m_screen->addTimer(m_disableJob, 5.0);
|
||||
|
||||
// use built-in X screen saver
|
||||
@ -193,6 +194,11 @@ log((CLOG_INFO "disable screensaver"));
|
||||
void
|
||||
CXWindowsScreenSaver::activate()
|
||||
{
|
||||
// remove disable job timer
|
||||
if (m_disabled) {
|
||||
m_screen->removeTimer(m_disableJob);
|
||||
}
|
||||
|
||||
// try xscreensaver
|
||||
findXScreenSaver();
|
||||
if (m_xscreensaver != None) {
|
||||
@ -207,6 +213,11 @@ CXWindowsScreenSaver::activate()
|
||||
void
|
||||
CXWindowsScreenSaver::deactivate()
|
||||
{
|
||||
// reinstall disable job timer
|
||||
if (m_disabled) {
|
||||
m_screen->addTimer(m_disableJob, 5.0);
|
||||
}
|
||||
|
||||
// try xscreensaver
|
||||
findXScreenSaver();
|
||||
if (m_xscreensaver != None) {
|
||||
|
@ -111,6 +111,9 @@ private:
|
||||
int m_preferBlanking;
|
||||
int m_allowExposures;
|
||||
|
||||
// true iff the disabled job timer is installed
|
||||
bool m_disabled;
|
||||
|
||||
// the job used to invoke disableCallback
|
||||
IJob* m_disableJob;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user