#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_socket(NULL),
m_useSecureNetwork(false),
m_args(args)
m_args(args),
m_enableClipboard(true)
{
assert(m_socketFactory != NULL);
assert(m_screen != NULL);
@ -264,10 +265,12 @@ Client::leave()
m_screen->leave();
// send clipboards that we own and that have changed
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
if (m_ownClipboard[id]) {
sendClipboard(id);
if (m_enableClipboard) {
// send clipboards that we own and that have changed
for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
if (m_ownClipboard[id]) {
sendClipboard(id);
}
}
}
@ -360,6 +363,20 @@ Client::resetOptions()
void
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);
}

View File

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

View File

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