Revert to old behavior of checkDesk(), add workaround to broken EnumClipboardFormats() in the case where the server is started while the screen saver is active.
This commit is contained in:
parent
425fc8b925
commit
bab2e985a3
|
@ -180,9 +180,24 @@ MSWindowsClipboard::get(EFormat format) const
|
||||||
win32Format = EnumClipboardFormats(win32Format);
|
win32Format = EnumClipboardFormats(win32Format);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no converter then we don't recognize any formats
|
// if no converter then EnumClipboardFormats() is broken: try just
|
||||||
|
// GetClipboardData() directly (Issue $5041)
|
||||||
if (converter == NULL) {
|
if (converter == NULL) {
|
||||||
LOG((CLOG_WARN "No converter for format %d", format));
|
LOG((CLOG_INFO "Broken EnumClipboardFormats, falling back to using GetClipboardData"));
|
||||||
|
|
||||||
|
for (ConverterList::const_iterator index = m_converters.begin();
|
||||||
|
index != m_converters.end(); ++index) {
|
||||||
|
converter = *index;
|
||||||
|
if (converter->getFormat() == format) {
|
||||||
|
LOG((CLOG_DEBUG "using converter 0x%x%s for %d\n",
|
||||||
|
converter->getWin32Format(),
|
||||||
|
l_name(converter->getWin32Format()).c_str(),
|
||||||
|
format));
|
||||||
|
HANDLE win32Data = GetClipboardData(converter->getWin32Format());
|
||||||
|
if (win32Data != NULL)
|
||||||
|
return converter->toIClipboard(win32Data);
|
||||||
|
}
|
||||||
|
}
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -851,24 +851,30 @@ MSWindowsDesks::checkDesk()
|
||||||
desk = index->second;
|
desk = index->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name == m_activeDeskName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_activeDesk != NULL) {
|
||||||
|
LOG((CLOG_DEBUG "switched desk \"%s\"->\"%s\"",
|
||||||
|
m_activeDeskName.c_str(), name.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we are told to shut down on desk switch, and this is not the
|
||||||
|
// first switch, then shut down.
|
||||||
|
if (m_stopOnDeskSwitch && m_activeDesk != NULL) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// if active desktop changed then tell the old and new desk threads
|
// if active desktop changed then tell the old and new desk threads
|
||||||
// about the change. don't switch desktops when the screensaver is
|
// about the change. don't switch desktops when the screensaver is
|
||||||
// active becaue we'd most likely switch to the screensaver desktop
|
// active becaue we'd most likely switch to the screensaver desktop
|
||||||
// which would have the side effect of forcing the screensaver to
|
// which would have the side effect of forcing the screensaver to
|
||||||
// stop.
|
// stop.
|
||||||
if (name != m_activeDeskName && !m_screensaver->isActive()) {
|
if (!m_screensaver->isActive()) {
|
||||||
// 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 - if it is restarted while the screen saver
|
|
||||||
// is active, the clipboard no longer works.
|
|
||||||
if (m_stopOnDeskSwitch && m_activeDesk != NULL) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// show cursor on previous desk
|
// show cursor on previous desk
|
||||||
bool wasOnScreen = m_isOnScreen;
|
bool wasOnScreen = m_isOnScreen;
|
||||||
if (!wasOnScreen) {
|
if (!wasOnScreen) {
|
||||||
|
@ -879,10 +885,6 @@ MSWindowsDesks::checkDesk()
|
||||||
// from an inaccessible desktop so when we switch from an
|
// from an inaccessible desktop so when we switch from an
|
||||||
// inaccessible desktop to an accessible one we have to
|
// inaccessible desktop to an accessible one we have to
|
||||||
// update the keyboard state.
|
// update the keyboard state.
|
||||||
if (m_activeDesk != NULL) {
|
|
||||||
LOG((CLOG_DEBUG "switched desk \"%s\"->\"%s\"",
|
|
||||||
m_activeDeskName.c_str(), name.c_str()));
|
|
||||||
}
|
|
||||||
bool syncKeys = false;
|
bool syncKeys = false;
|
||||||
bool isAccessible = isDeskAccessible(desk);
|
bool isAccessible = isDeskAccessible(desk);
|
||||||
if (isDeskAccessible(m_activeDesk) != isAccessible) {
|
if (isDeskAccessible(m_activeDesk) != isAccessible) {
|
||||||
|
@ -910,19 +912,17 @@ MSWindowsDesks::checkDesk()
|
||||||
updateKeys();
|
updateKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (name != m_activeDeskName) {
|
else {
|
||||||
if (m_activeDesk != NULL) {
|
|
||||||
LOG((CLOG_DEBUG "switched desk \"%s\"->\"%s\"",
|
|
||||||
m_activeDeskName.c_str(), name.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// screen saver is active (see check above)
|
// screen saver is active (see check above)
|
||||||
PostThreadMessage(m_threadID, SYNERGY_MSG_SCREEN_SAVER, TRUE, 0);
|
PostThreadMessage(m_threadID, SYNERGY_MSG_SCREEN_SAVER, TRUE, 0);
|
||||||
|
// FIXME? Because m_activeDesk isn't updated if screen saver is active,
|
||||||
|
// SYNERGY_MSG_SCREEN_SAVER will be sent on every call to checkDesk()
|
||||||
|
// until isActive() returns false, since name will not match
|
||||||
|
// m_activeDeskName until the latter is updated.
|
||||||
|
|
||||||
// Prevent this from retriggering over and over if screen saver stays
|
// For now, preserve old (broken?) behavior.
|
||||||
// active:
|
//m_activeDesk = desk;
|
||||||
m_activeDesk = desk;
|
//m_activeDeskName = name;
|
||||||
m_activeDeskName = name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue