#123 Made disable clipboard take effect on client

This commit is contained in:
Xinyu Hou 2016-09-15 16:45:36 -04:00 committed by Andrew Nelless
parent 90673e8b87
commit eafc548b97
3 changed files with 24 additions and 8 deletions

View File

@ -73,7 +73,8 @@ Client::Client(
m_writeToDropDirThread(NULL), m_writeToDropDirThread(NULL),
m_socket(NULL), m_socket(NULL),
m_useSecureNetwork(false), m_useSecureNetwork(false),
m_args(args) m_args(args),
m_enableClipboard(true)
{ {
assert(m_socketFactory != NULL); assert(m_socketFactory != NULL);
assert(m_screen != NULL); assert(m_screen != NULL);
@ -264,12 +265,14 @@ Client::leave()
m_screen->leave(); m_screen->leave();
if (m_enableClipboard) {
// send clipboards that we own and that have changed // send clipboards that we own and that have changed
for (ClipboardID id = 0; id < kClipboardEnd; ++id) { for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
if (m_ownClipboard[id]) { if (m_ownClipboard[id]) {
sendClipboard(id); sendClipboard(id);
} }
} }
}
return true; return true;
} }
@ -360,6 +363,20 @@ Client::resetOptions()
void void
Client::setOptions(const OptionsList& options) Client::setOptions(const OptionsList& options)
{ {
for (OptionsList::const_iterator index = options.cbegin();
index != options.cend(); ++index) {
const OptionID id = *index;
if (id == kOptionClipboardSharing) {
index++;
if (*index == static_cast<OptionValue>(false)) {
LOG((CLOG_NOTE "clipboard sharing is disabled"));
}
m_enableClipboard = *index;
break;
}
}
m_screen->setOptions(options); m_screen->setOptions(options);
} }

View File

@ -223,4 +223,5 @@ private:
TCPSocket* m_socket; TCPSocket* m_socket;
bool m_useSecureNetwork; bool m_useSecureNetwork;
ClientArgs m_args; ClientArgs m_args;
bool m_enableClipboard;
}; };

View File

@ -833,9 +833,7 @@ ServerProxy::setOptions()
// update keep alive // update keep alive
setKeepAliveRate(1.0e-3 * static_cast<double>(options[i + 1])); setKeepAliveRate(1.0e-3 * static_cast<double>(options[i + 1]));
} }
else if (options[i] == kOptionClipboardSharing) {
LOG((CLOG_DEBUG "disable clipboard sharing"));
}
if (id != kKeyModifierIDNull) { if (id != kKeyModifierIDNull) {
m_modifierTranslationTable[id] = m_modifierTranslationTable[id] =
static_cast<KeyModifierID>(options[i + 1]); static_cast<KeyModifierID>(options[i + 1]);