Fixed Issue #14: Synergy client on windows will not bring up desktop after screen powersave

This commit is contained in:
sveith 2009-03-22 17:03:39 +00:00
parent ef7d5e4d08
commit 3580a29fd8
3 changed files with 36 additions and 0 deletions

View File

@ -414,3 +414,26 @@ CArchMiscWindows::dummySetThreadExecutionState(DWORD)
// do nothing
return 0;
}
void
CArchMiscWindows::wakeupDisplay()
{
// We can't use ::setThreadExecutionState here because it sets
// ES_CONTINUOUS, which we don't want.
if (s_stes == NULL) {
HINSTANCE kernel = LoadLibrary("kernel32.dll");
if (kernel != NULL) {
s_stes = reinterpret_cast<STES_t>(GetProcAddress(kernel,
"SetThreadExecutionState"));
}
if (s_stes == NULL) {
s_stes = &CArchMiscWindows::dummySetThreadExecutionState;
}
}
s_stes(ES_DISPLAY_REQUIRED);
// restore the original execution states
setThreadExecutionState(s_busyState);
}

View File

@ -161,6 +161,9 @@ public:
//! Enable power saving
static void removeBusyState(DWORD busyModes);
//! Briefly interrupt power saving
static void wakeupDisplay();
private:
//! Open and return a registry key, closing the parent key
static HKEY openKey(HKEY parent, const TCHAR* child, bool create);

View File

@ -263,6 +263,16 @@ CMSWindowsScreen::enter()
// all messages prior to now are invalid
nextMark();
} else {
// Entering a secondary screen. Ensure that no screensaver is active
// and that the screen is not in powersave mode.
CArchMiscWindows::wakeupDisplay();
if(m_screensaver != NULL && m_screensaverActive)
{
m_screensaver->deactivate();
m_screensaverActive = 0;
}
}
// now on screen