#123 Made disable clipboard take effect on server

This commit is contained in:
Xinyu Hou 2016-09-15 16:19:10 -04:00 committed by Andrew Nelless
parent 9c0bac7c7d
commit 673829f511
3 changed files with 17 additions and 6 deletions

View File

@ -765,7 +765,7 @@ Config::readSectionOptions(ConfigReadContext& s)
else if (name == "win32KeepForeground") {
addOption("", kOptionWin32KeepForeground, s.parseBoolean(value));
}
else if (name == "enableClipboard") {
else if (name == "clipboardSharing") {
addOption("", kOptionClipboardSharing, s.parseBoolean(value));
}
@ -1380,6 +1380,9 @@ Config::getOptionName(OptionID id)
if (id == kOptionScreenPreserveFocus) {
return "preserveFocus";
}
if (id == kOptionClipboardSharing) {
return "clipboardSharing";
}
return NULL;
}
@ -1396,7 +1399,8 @@ Config::getOptionValue(OptionID id, OptionValue value)
id == kOptionXTestXineramaUnaware ||
id == kOptionRelativeMouseMoves ||
id == kOptionWin32KeepForeground ||
id == kOptionScreenPreserveFocus) {
id == kOptionScreenPreserveFocus ||
id == kOptionClipboardSharing) {
return (value != 0) ? "true" : "false";
}
if (id == kOptionModifierMapForShift ||

View File

@ -92,6 +92,7 @@ Server::Server(
m_writeToDropDirThread(NULL),
m_ignoreFileTransfer(false),
m_enableDragDrop(enableDragDrop),
m_enableClipboard(true),
m_sendDragInfoThread(NULL),
m_waitDragInfoThread(true)
{
@ -485,7 +486,7 @@ Server::switchScreen(BaseClientProxy* dst,
// update the primary client's clipboards if we're leaving the
// primary screen.
if (m_active == m_primaryClient) {
if (m_active == m_primaryClient && m_enableClipboard) {
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
ClipboardInfo& clipboard = m_clipboards[id];
if (clipboard.m_clipboardOwner == getName(m_primaryClient)) {
@ -506,9 +507,11 @@ Server::switchScreen(BaseClientProxy* dst,
m_primaryClient->getToggleMask(),
forScreensaver);
// send the clipboard data to new active screen
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
m_active->setClipboard(id, &m_clipboards[id].m_clipboard);
if (m_enableClipboard) {
// send the clipboard data to new active screen
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
m_active->setClipboard(id, &m_clipboards[id].m_clipboard);
}
}
Server::SwitchToScreenInfo* info =
@ -1166,6 +1169,9 @@ Server::processOptions()
else if (id == kOptionRelativeMouseMoves) {
newRelativeMoves = (value != 0);
}
else if (id == kOptionClipboardSharing) {
m_enableClipboard = (value != 0);
}
}
if (m_relativeMoves && !newRelativeMoves) {
stopRelativeMoves();

View File

@ -473,6 +473,7 @@ private:
String m_dragFileExt;
bool m_ignoreFileTransfer;
bool m_enableDragDrop;
bool m_enableClipboard;
Thread* m_sendDragInfoThread;
bool m_waitDragInfoThread;