Fix kdesktop_lock interaction with DPMS power save

This partially resolves Bug 1475
pull/2/head
Timothy Pearson 11 years ago
parent 93bbac1431
commit be61b99598

@ -130,6 +130,8 @@ Status DPMSInfo ( Display *, CARD16 *, BOOL * );
#define XF86XK_AudioLowerVolume 0x1008FF11 #define XF86XK_AudioLowerVolume 0x1008FF11
#define XF86XK_Display 0x1008FF59 #define XF86XK_Display 0x1008FF59
#define DPMS_MONITOR_BLANKED(x) ((x == DPMSModeStandby) || (x == DPMSModeSuspend) || (x == DPMSModeOff))
static Window gVRoot = 0; static Window gVRoot = 0;
static Window gVRootData = 0; static Window gVRootData = 0;
static Atom gXA_VROOT; static Atom gXA_VROOT;
@ -376,7 +378,7 @@ void LockProcess::init(bool child, bool useBlankOnly)
connect(&mSuspendTimer, TQT_SIGNAL(timeout()), TQT_SLOT(suspend())); connect(&mSuspendTimer, TQT_SIGNAL(timeout()), TQT_SLOT(suspend()));
#ifdef HAVE_DPMS #ifdef HAVE_DPMS
//if the user decided that the screensaver should run independent from //if the user decided that the screensaver should run independent from
//dpms, we shouldn't check for it, aleXXX //dpms, we shouldn't check for it, aleXXX
if (KDesktopSettings::dpmsDependent()) { if (KDesktopSettings::dpmsDependent()) {
BOOL on; BOOL on;
@ -1436,15 +1438,34 @@ bool LockProcess::startLock()
void LockProcess::closeDialogAndStartHack() void LockProcess::closeDialogAndStartHack()
{ {
// Close any active dialogs #ifdef HAVE_DPMS
DISABLE_CONTINUOUS_LOCKDLG_DISPLAY if (KDesktopSettings::dpmsDependent()) {
mSuspended = true; BOOL on;
if (closeCurrentWindow()) { CARD16 state;
TQTimer::singleShot( 0, this, SLOT(closeDialogAndStartHack()) ); if (DPMSInfo(tqt_xdisplay(), &state, &on)) {
} //kdDebug() << "checkDPMSActive " << on << " " << state << endl;
else { if (DPMS_MONITOR_BLANKED(state)) {
resume(true); // Make sure saver will attempt to start again after DPMS wakeup
} // This is related to Bug 1475
ENABLE_CONTINUOUS_LOCKDLG_DISPLAY
if (mHackStartupEnabled) mHackDelayStartupTimer->start(mHackDelayStartupTimeout, TRUE);
// Should not start saver here, because the DPMS check method below would turn it right back off!
// This is related to Bug 1475
return;
}
}
}
#endif
// Close any active dialogs
DISABLE_CONTINUOUS_LOCKDLG_DISPLAY
mSuspended = true;
if (closeCurrentWindow()) {
TQTimer::singleShot( 0, this, SLOT(closeDialogAndStartHack()) );
}
else {
resume(true);
}
} }
void LockProcess::repaintRootWindowIfNeeded() void LockProcess::repaintRootWindowIfNeeded()
@ -2218,19 +2239,21 @@ void LockProcess::stayOnTop()
void LockProcess::checkDPMSActive() void LockProcess::checkDPMSActive()
{ {
#ifdef HAVE_DPMS #ifdef HAVE_DPMS
BOOL on; if (KDesktopSettings::dpmsDependent()) {
CARD16 state; BOOL on;
DPMSInfo(tqt_xdisplay(), &state, &on); CARD16 state;
//kdDebug() << "checkDPMSActive " << on << " " << state << endl; if (DPMSInfo(tqt_xdisplay(), &state, &on)) {
if (state == DPMSModeStandby || state == DPMSModeSuspend || state == DPMSModeOff) //kdDebug() << "checkDPMSActive " << on << " " << state << endl;
{ if (DPMS_MONITOR_BLANKED(state)) {
suspend(); suspend();
} else if ( mSuspended ) }
{ else if (mSuspended) {
if (mResizingDesktopLock == false) { if (mResizingDesktopLock == false) {
resume( true ); resume( true );
} }
} }
}
}
#endif #endif
} }

Loading…
Cancel
Save