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

View File

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

View File

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