From 673829f511d976384ed1967a7d754af535f27b2c Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Thu, 15 Sep 2016 16:19:10 -0400 Subject: [PATCH] #123 Made disable clipboard take effect on server --- src/lib/server/Config.cpp | 8 ++++++-- src/lib/server/Server.cpp | 14 ++++++++++---- src/lib/server/Server.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index 4b87764f..dac8f58e 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -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 || diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index cdec86f4..4e1a728a 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -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(); diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index 610718c4..7681487a 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -473,6 +473,7 @@ private: String m_dragFileExt; bool m_ignoreFileTransfer; bool m_enableDragDrop; + bool m_enableClipboard; Thread* m_sendDragInfoThread; bool m_waitDragInfoThread;