From 9036d42469d792b5ace6bda1e70b3fbede97c56e Mon Sep 17 00:00:00 2001 From: Nye Liu Date: Wed, 7 Oct 2015 21:23:26 -0700 Subject: [PATCH] Issue #5041 - properly update activeDesk and activeDeskName when screen saver activates Ensure that we actually kill the server if we go from screen saver desk to real desk. --- src/lib/platform/MSWindowsDesks.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index 98fcbb7d..775b1396 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -851,15 +851,22 @@ MSWindowsDesks::checkDesk() desk = index->second; } - // if we are told to shut down on desk switch, and this is not the + // if we are told to shut down on desk switch, and this is not the // first switch, then shut down. // Issue #5041 workaround - prevent synergys from shutting down when screen - // saver activates - It does not come back cleanly. - if (m_stopOnDeskSwitch && m_activeDesk != NULL && name != m_activeDeskName - && !m_screensaver->isActive()) { - LOG((CLOG_DEBUG "shutting down because of desk switch to \"%s\"", name.c_str())); - m_events->addEvent(Event(Event::kQuit)); - return; + // saver activates - if it is restarted while the screen saver is active, + // the clipboard no longer works. + if (m_stopOnDeskSwitch && m_activeDesk != NULL && name != m_activeDeskName) { + if (!m_screensaver->isActive()) { + LOG((CLOG_DEBUG "shutting down because of desk switch \"%s\"->\"%s\"", + m_activeDeskName.c_str(), name.c_str())); + m_events->addEvent(Event(Event::kQuit)); + return; + } + LOG((CLOG_DEBUG "screen saver active, ignoring desk switch \"%s\"->\"%s\"", + m_activeDeskName.c_str(), name.c_str())); + m_activeDesk = desk; + m_activeDeskName = name; } // if active desktop changed then tell the old and new desk threads