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_display(display),
|
||||||
m_notify(None),
|
m_notify(None),
|
||||||
m_xscreensaver(None),
|
m_xscreensaver(None),
|
||||||
m_xscreensaverActive(false)
|
m_xscreensaverActive(false),
|
||||||
|
m_disabled(false)
|
||||||
{
|
{
|
||||||
// screen saver disable callback
|
// screen saver disable callback
|
||||||
m_disableJob = new TMethodJob<CXWindowsScreenSaver>(this,
|
m_disableJob = new TMethodJob<CXWindowsScreenSaver>(this,
|
||||||
|
@ -165,8 +166,8 @@ CXWindowsScreenSaver::setNotify(Window notify)
|
||||||
void
|
void
|
||||||
CXWindowsScreenSaver::enable()
|
CXWindowsScreenSaver::enable()
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "enable screensaver"));
|
|
||||||
// for xscreensaver
|
// for xscreensaver
|
||||||
|
m_disabled = false;
|
||||||
m_screen->removeTimer(m_disableJob);
|
m_screen->removeTimer(m_disableJob);
|
||||||
|
|
||||||
// for built-in X screen saver
|
// for built-in X screen saver
|
||||||
|
@ -177,9 +178,9 @@ log((CLOG_INFO "enable screensaver"));
|
||||||
void
|
void
|
||||||
CXWindowsScreenSaver::disable()
|
CXWindowsScreenSaver::disable()
|
||||||
{
|
{
|
||||||
log((CLOG_INFO "disable screensaver"));
|
|
||||||
// for xscreensaver. 5 seconds should be plenty often to
|
// for xscreensaver. 5 seconds should be plenty often to
|
||||||
// suppress the screen saver.
|
// suppress the screen saver.
|
||||||
|
m_disabled = true;
|
||||||
m_screen->addTimer(m_disableJob, 5.0);
|
m_screen->addTimer(m_disableJob, 5.0);
|
||||||
|
|
||||||
// use built-in X screen saver
|
// use built-in X screen saver
|
||||||
|
@ -193,6 +194,11 @@ log((CLOG_INFO "disable screensaver"));
|
||||||
void
|
void
|
||||||
CXWindowsScreenSaver::activate()
|
CXWindowsScreenSaver::activate()
|
||||||
{
|
{
|
||||||
|
// remove disable job timer
|
||||||
|
if (m_disabled) {
|
||||||
|
m_screen->removeTimer(m_disableJob);
|
||||||
|
}
|
||||||
|
|
||||||
// try xscreensaver
|
// try xscreensaver
|
||||||
findXScreenSaver();
|
findXScreenSaver();
|
||||||
if (m_xscreensaver != None) {
|
if (m_xscreensaver != None) {
|
||||||
|
@ -207,6 +213,11 @@ CXWindowsScreenSaver::activate()
|
||||||
void
|
void
|
||||||
CXWindowsScreenSaver::deactivate()
|
CXWindowsScreenSaver::deactivate()
|
||||||
{
|
{
|
||||||
|
// reinstall disable job timer
|
||||||
|
if (m_disabled) {
|
||||||
|
m_screen->addTimer(m_disableJob, 5.0);
|
||||||
|
}
|
||||||
|
|
||||||
// try xscreensaver
|
// try xscreensaver
|
||||||
findXScreenSaver();
|
findXScreenSaver();
|
||||||
if (m_xscreensaver != None) {
|
if (m_xscreensaver != None) {
|
||||||
|
|
|
@ -111,6 +111,9 @@ private:
|
||||||
int m_preferBlanking;
|
int m_preferBlanking;
|
||||||
int m_allowExposures;
|
int m_allowExposures;
|
||||||
|
|
||||||
|
// true iff the disabled job timer is installed
|
||||||
|
bool m_disabled;
|
||||||
|
|
||||||
// the job used to invoke disableCallback
|
// the job used to invoke disableCallback
|
||||||
IJob* m_disableJob;
|
IJob* m_disableJob;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue